I am trying to install react-native-fbsdk via npm, and whereas my build worked perfectly before, once I install the library and install pods, I get the following error:
ld: warning: Could not find or use auto-linked library 'swiftCoreFoundation'
ld: warning: Could not find or use auto-linked library 'swiftCompatibility50'
ld: warning: Could not find or use auto-linked library 'swiftObjectiveC'
ld: warning: Could not find or use auto-linked library 'swiftFoundation'
ld: warning: Could not find or use auto-linked library 'swiftsimd'
ld: warning: Could not find or use auto-linked library 'swiftDarwin'
ld: warning: Could not find or use auto-linked library 'swiftUIKit'
ld: warning: Could not find or use auto-linked library 'swiftCore'
ld: warning: Could not find or use auto-linked library 'swiftQuartzCore'
ld: warning: Could not find or use auto-linked library 'swiftCoreGraphics'
ld: warning: Could not find or use auto-linked library 'swiftPhotos'
ld: warning: Could not find or use auto-linked library 'swiftSwiftOnoneSupport'
ld: warning: Could not find or use auto-linked library 'swiftCoreImage'
ld: warning: Could not find or use auto-linked library 'swiftCompatibilityDynamicReplacements'
ld: warning: Could not find or use auto-linked library 'swiftMetal'
ld: warning: Could not find or use auto-linked library 'swiftDispatch'
ld: warning: Could not find or use auto-linked library 'swiftAVFoundation'
ld: warning: Could not find or use auto-linked library 'swiftCoreMedia'
ld: warning: Could not find or use auto-linked library 'swiftCoreAudio'
ld: warning: Could not find or use auto-linked library 'swiftCoreMIDI'
ld: warning: Could not find or use auto-linked library 'swiftCoreLocation'
Undefined symbols for architecture x86_64:
"protocol descriptor for Foundation.CustomNSError", referenced from:
protocol conformance descriptor for __C_Synthesized.related decl 'e' for FBSDKLoginError : Foundation.CustomNSError in __C_Synthesized in libFBSDKLoginKit.a(LoginManager.o)
"method descriptor for static Foundation.CustomNSError.errorDomain.getter : Swift.String", referenced from:
protocol conformance descriptor for __C_Synthesized.related decl 'e' for FBSDKLoginError : Foundation.CustomNSError in __C_Synthesized in libFBSDKLoginKit.a(LoginManager.o)
"method descriptor for Foundation.CustomNSError.errorUserInfo.getter : [Swift.String : Any]", referenced from:
protocol conformance descriptor for __C_Synthesized.related decl 'e' for FBSDKLoginError : Foundation.CustomNSError in __C_Synthesized in libFBSDKLoginKit.a(LoginManager.o)
"method descriptor for Foundation.CustomNSError.errorCode.getter : Swift.Int", referenced from:
protocol conformance descriptor for __C_Synthesized.related decl 'e' for FBSDKLoginError : Foundation.CustomNSError in __C_Synthesized in libFBSDKLoginKit.a(LoginManager.o)
"base conformance descriptor for Foundation.CustomNSError: Swift.Error", referenced from:
protocol conformance descriptor for __C_Synthesized.related decl 'e' for FBSDKLoginError : Foundation.CustomNSError in __C_Synthesized in libFBSDKLoginKit.a(LoginManager.o)
"protocol descriptor for Foundation._ErrorCodeProtocol", referenced from:
... etc
I've searched everywhere for a solution to this problem and I am not seeing how to solve this library issue.
I am on React Native .60.5 - is there any solution for this problem?
Create a swift file in the main project (File.swift) and add the following code to the same In case you see the issue after updating React Native from 0.63.x to 0.64.x, try this solution: Compare package.json of the new project and of your old 0.63.x project, and modify the old one.
All the libraries we ship with React Native live on the Libraries folder in the root of the repository. Some of them are pure JavaScript, and you only need to require it.
According to the official announcement “The team working on the React Native CLI has introduced major improvements to native module linking called auto-linking! Most scenarios will not require the use of a react-native link anymore.” So to conclude there is no linking anymore but there are some additional changes also let’s see the example.
If you do need to call it from native, then we need to know the library's headers. To achieve that you have to go to your project's file, select Build Settings and search for Header Search Paths. There you should include the path to your library.
To resolve this problem you just need to add swift file and ** "Create Bridging Header"** in your Xcode project.
Or you can see bellow link to understand this so well
Why linker link static libraries with errors? iOS
I fixed this by adding a .swift file via xcode
I tried a few combinations of these steps but found I needed all of them (ie. it must be done via xcode, you do need the bridging header, and you do need to clean the build folder).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With