Build Error on Xcode 15.3: "Called object type 'facebook::flipper::SocketCertificateProvider' is not a function or function pointer"
Asked Answered
L

8

25

I recently updated my Xcode to version 15.3 and encountered an issue while trying to build my React Native app on the simulator. The error message I'm receiving is:

"Called object type 'facebook::flipper::SocketCertificateProvider' is not a function or function pointer."

My react-native version is 0.71.8

Could someone please advise on how to resolve this error and successfully build my React Native app on Xcode 15.3? Any insights or suggestions would be greatly appreciated.

enter image description here

Longstanding answered 7/3 at 12:3 Comment(0)
C
45

The solution to this error.....

https://github.com/facebook/react-native/issues/43335#issuecomment-1980285308

update...

1- from project navigator search about ==> FlipperTransportTypes

2- add this import ==> #include "functional"

3- save file and run again

Clairvoyance answered 7/3 at 14:59 Comment(6)
I won't call it a solution, but more of a hack to make it build right now - the file is managed by CocoaPods so it needs to be changed after each pod install Unfortunately, it doesn't seem like the Flipper team is in a hurry to build releases of the new version tags mentioned and recommended in their documentation...Blunge
So @EsbenvonBuchwald what is now the right way to fix this?Elseelset
This is the solution github.com/facebook/react-native/issues/…Ardith
Now you can upgrade flipper to version 0.250.0 by specifying it in the podfile, that will make it build in latest xcode.Blunge
@EsbenvonBuchwald I added an answer below that updates the Podfile so you do not need to hack this every time if it helpsCoenocyte
It would be great to update this accepted answer with the news that upgrading to 0.250.0 fixes this :)Blunge
I
11

Add #include functional like the pic below:

enter image description here

Impudent answered 21/3 at 14:41 Comment(0)
C
10

To address @EsbenvonBuchwald's comment above, add the following in your Podfile's post_install section so you don't need to apply this fix every time you run npx pod install:

  post_install do |installer|
    ...
    ...
    installer.pods_project.targets.each do |target|
      if target.name == 'Flipper'
        file_path = 'Pods/Flipper/xplat/Flipper/FlipperTransportTypes.h'
        contents = File.read(file_path)
        unless contents.include?('#include <functional>')
          File.chmod(0755, file_path)
          File.open(file_path, 'w') do |file|
            file.puts('#include <functional>')
            file.puts(contents)
          end
        end
      end
    end
  end
Coenocyte answered 13/4 at 7:56 Comment(2)
Upgrading flipper is the way to go now, instead of patching :) https://mcmap.net/q/524282/-build-error-on-xcode-15-3-quot-called-object-type-39-facebook-flipper-socketcertificateprovider-39-is-not-a-function-or-function-pointer-quotBlunge
Cool, good to have both options available for developers to choose fromCoenocyte
I
6

I was able to find temp fix with adding

#include <functional> 

to

ios/Pods/Flipper/xplat/Flipper/FlipperTransportTypes.h

maybe flipper needs an upgrade

Inexplicable answered 2/4 at 7:27 Comment(0)
B
3

Now you can upgrade flipper to version 0.250.0 by specifying it in the podfile, that will make it build in latest xcode.

This line does the trick:

  :flipper_configuration => FlipperConfiguration.enabled(["Debug"], { 'Flipper' => '0.250.0' }),

Running 0.250.0 does not seem to cause issues with the react-native-flipper library which is older, or with the flipper client which is also older.

Blunge answered 3/4 at 5:49 Comment(3)
Do you think you could provide some code as a visual to help other users more confidently know they are updating the correct line of code in the Podfile? Albeit, sometimes version bumping a foundational framework isn't always ideal. I always hesitate to bump react-native version and end up spending hours trying to deal with old RN libraries that were not updated to for the newest version of RN😝Coenocyte
@Coenocyte I've updated my answer. flipper is a development-only dependency and upgrading does not cause the same headache as upgrading RNBlunge
Check this for more details: fbflipper.com/docs/getting-started/react-native/…Atingle
A
1

click on flipper error in Xcode, now flipper file will open , then just add this

#include <functional>

Thank me later. Happy coding.

Archi answered 9/5 at 18:39 Comment(0)
S
0

If you are using a CI/CD or need a CLI fix

Execute the following command inside your project.

if ! grep -q "#include <functional>" ./ios/Pods/Flipper/xplat/Flipper/FlipperTransportTypes.h; 
then
    chmod 755 ./ios/Pods/Flipper/xplat/Flipper/FlipperTransportTypes.h && sed -i '' 's|#include <string>|#include <functional>\n#include <string>|'  ./ios/Pods/Flipper/xplat/Flipper/FlipperTransportTypes.h
fi

then Clean and rebuild

Slapjack answered 10/3 at 13:15 Comment(1)
make sure this is run after pod installCoenocyte
C
-3

In Podfile, remove use_flipper!()

Crittenden answered 10/4 at 18:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.