7
votes

I've follow all the guidelines listed on Facebook developer guide for the iOS react native sdk but i'm still unable to build the app. Attached a screenshot of my config and the build log

enter image description here

Ld /Users/alaaattya/Library/Developer/Xcode/DerivedData/Alnomad-fcoerljazsnnxbggcygydgyxmimr/Build/Products/Debug-iphonesimulator/Alnomad.app/Alnomad normal x86_64 cd /Applications/MAMP/htdocs/marscodes/alnomad-ios/ios export IPHONEOS_DEPLOYMENT_TARGET=8.0 export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.3.sdk -L/Users/alaaattya/Library/Developer/Xcode/DerivedData/Alnomad-fcoerljazsnnxbggcygydgyxmimr/Build/Products/Debug-iphonesimulator -F/Users/alaaattya/Library/Developer/Xcode/DerivedData/Alnomad-fcoerljazsnnxbggcygydgyxmimr/Build/Products/Debug-iphonesimulator -F/Applications/MAMP/htdocs/marscodes/alnomad-ios/ios/../node_modules/react-native-facebook-login/FacebookSDK -F/Applications/MAMP/htdocs/marscodes/alnomad-ios/ios -F. -FAlnomad -FAlnomadTests -Fbuild -FFacebookSDK -Fbuild/Build -Fbuild/Logs -FFacebookSDK/AccountKitStrings.bundle -FFacebookSDK/DocSets -FFacebookSDK/FacebookSDKStrings.bundle -FFacebookSDK/Samples -Fbuild/Logs/Build -FFacebookSDK/AccountKitStrings.bundle/Resources -FFacebookSDK/DocSets/FacebookAudienceNetworkSDK-4_13-for-iOS.docset -FFacebookSDK/DocSets/FacebookMessengerShareKitSDK-1_3-for-iOS.docset -FFacebookSDK/DocSets/FacebookSDK-4_13-for-iOS.docset -FFacebookSDK/FacebookSDKStrings.bundle/Resources -FFacebookSDK/Samples/Configurations -FFacebookSDK/Samples/FBAudienceNetwork -FFacebookSDK/Samples/Iconicus -FFacebookSDK/Samples/RPSSample -FFacebookSDK/Samples/Scrumptious -FFacebookSDK/Samples/ShareIt -FFacebookSDK/Samples/SwitchUserSample -FFacebookSDK/DocSets/FacebookAudienceNetworkSDK-4_13-for-iOS.docset/Contents -FFacebookSDK/DocSets/FacebookMessengerShareKitSDK-1_3-for-iOS.docset/Contents -FFacebookSDK/DocSets/FacebookSDK-4_13-for-iOS.docset/Contents -FFacebookSDK/Samples/FBAudienceNetwork/AdUnitsSample -FFacebookSDK/Samples/FBAudienceNetwork/NativeAdSample -FFacebookSDK/Samples/Iconicus/Configurations -FFacebookSDK/Samples/Iconicus/Iconicus -FFacebookSDK/Samples/RPSSample/RPSSample -FFacebookSDK/Samples/Scrumptious/scrumptious -FFacebookSDK/Samples/ShareIt/ShareIt -FFacebookSDK/Samples/SwitchUserSample/SwitchUserSample -FFacebookSDK/DocSets/FacebookAudienceNetworkSDK-4_13-for-iOS.docset/Contents/Resources -FFacebookSDK/DocSets/FacebookMessengerShareKitSDK-1_3-for-iOS.docset/Contents/Resources -FFacebookSDK/DocSets/FacebookSDK-4_13-for-iOS.docset/Contents/Resources -FFacebookSDK/Samples/FBAudienceNetwork/AdUnitsSample/AdUnitsSample -FFacebookSDK/Samples/FBAudienceNetwork/NativeAdSample/NativeAdSample -FFacebookSDK/DocSets/FacebookAudienceNetworkSDK-4_13-for-iOS.docset/Contents/Resources/Documents -FFacebookSDK/DocSets/FacebookMessengerShareKitSDK-1_3-for-iOS.docset/Contents/Resources/Documents -FFacebookSDK/DocSets/FacebookSDK-4_13-for-iOS.docset/Contents/Resources/Documents -FFacebookSDK/DocSets/FacebookAudienceNetworkSDK-4_13-for-iOS.docset/Contents/Resources/Documents/Classes -FFacebookSDK/DocSets/FacebookAudienceNetworkSDK-4_13-for-iOS.docset/Contents/Resources/Documents/Constants -FFacebookSDK/DocSets/FacebookAudienceNetworkSDK-4_13-for-iOS.docset/Contents/Resources/Documents/css -FFacebookSDK/DocSets/FacebookAudienceNetworkSDK-4_13-for-iOS.docset/Contents/Resources/Documents/img -FFacebookSDK/DocSets/FacebookAudienceNetworkSDK-4_13-for-iOS.docset/Contents/Resources/Documents/Protocols -FFacebookSDK/DocSets/FacebookMessengerShareKitSDK-1_3-for-iOS.docset/Contents/Resources/Documents/Classes -FFacebookSDK/DocSets/FacebookMessengerShareKitSDK-1_3-for-iOS.docset/Contents/Resources/Documents/Constants -FFacebookSDK/DocSets/FacebookMessengerShareKitSDK-1_3-for-iOS.docset/Contents/Resources/Documents/css -FFacebookSDK/DocSets/FacebookMessengerShareKitSDK-1_3-for-iOS.docset/Contents/Resources/Documents/img -FFacebookSDK/DocSets/FacebookMessengerShareKitSDK-1_3-for-iOS.docset/Contents/Resources/Documents/Protocols -FFacebookSDK/DocSets/FacebookSDK-4_13-for-iOS.docset/Contents/Resources/Documents/Classes -FFacebookSDK/DocSets/FacebookSDK-4_13-for-iOS.docset/Contents/Resources/Documents/Constants -FFacebookSDK/DocSets/FacebookSDK-4_13-for-iOS.docset/Contents/Resources/Documents/css -FFacebookSDK/DocSets/FacebookSDK-4_13-for-iOS.docset/Contents/Resources/Documents/img -FFacebookSDK/DocSets/FacebookSDK-4_13-for-iOS.docset/Contents/Resources/Documents/Protocols -F/Applications/MAMP/htdocs/marscodes/alnomad-ios/ios/FacebookSDK -filelist /Users/alaaattya/Library/Developer/Xcode/DerivedData/Alnomad-fcoerljazsnnxbggcygydgyxmimr/Build/Intermediates/Alnomad.build/Debug-iphonesimulator/Alnomad.build/Objects-normal/x86_64/Alnomad.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -mios-simulator-version-min=8.0 -Xlinker -no_deduplicate -Xlinker -objc_abi_version -Xlinker 2 -ObjC -lc++ -fobjc-arc -fobjc-link-runtime /Users/alaaattya/Library/Developer/Xcode/DerivedData/Alnomad-fcoerljazsnnxbggcygydgyxmimr/Build/Products/Debug-iphonesimulator/libReact.a /Users/alaaattya/Library/Developer/Xcode/DerivedData/Alnomad-fcoerljazsnnxbggcygydgyxmimr/Build/Products/Debug-iphonesimulator/libRCTActionSheet.a -framework FBSDKLoginKit /Users/alaaattya/Library/Developer/Xcode/DerivedData/Alnomad-fcoerljazsnnxbggcygydgyxmimr/Build/Products/Debug-iphonesimulator/libRCTGeolocation.a /Users/alaaattya/Library/Developer/Xcode/DerivedData/Alnomad-fcoerljazsnnxbggcygydgyxmimr/Build/Products/Debug-iphonesimulator/libRCTImage.a /Users/alaaattya/Library/Developer/Xcode/DerivedData/Alnomad-fcoerljazsnnxbggcygydgyxmimr/Build/Products/Debug-iphonesimulator/libRCTLinking.a /Users/alaaattya/Library/Developer/Xcode/DerivedData/Alnomad-fcoerljazsnnxbggcygydgyxmimr/Build/Products/Debug-iphonesimulator/libRCTNetwork.a /Users/alaaattya/Library/Developer/Xcode/DerivedData/Alnomad-fcoerljazsnnxbggcygydgyxmimr/Build/Products/Debug-iphonesimulator/libRCTSettings.a -framework FBSDKShareKit /Users/alaaattya/Library/Developer/Xcode/DerivedData/Alnomad-fcoerljazsnnxbggcygydgyxmimr/Build/Products/Debug-iphonesimulator/libRCTText.a /Users/alaaattya/Library/Developer/Xcode/DerivedData/Alnomad-fcoerljazsnnxbggcygydgyxmimr/Build/Products/Debug-iphonesimulator/libRCTVibration.a /Users/alaaattya/Library/Developer/Xcode/DerivedData/Alnomad-fcoerljazsnnxbggcygydgyxmimr/Build/Products/Debug-iphonesimulator/libRCTWebSocket.a -lRNVectorIcons -framework FBSDKCoreKit -lRNI18n -lRCTFBSDK -Xlinker -dependency_info -Xlinker /Users/alaaattya/Library/Developer/Xcode/DerivedData/Alnomad-fcoerljazsnnxbggcygydgyxmimr/Build/Intermediates/Alnomad.build/Debug-iphonesimulator/Alnomad.build/Objects-normal/x86_64/Alnomad_dependency_info.dat -o /Users/alaaattya/Library/Developer/Xcode/DerivedData/Alnomad-fcoerljazsnnxbggcygydgyxmimr/Build/Products/Debug-iphonesimulator/Alnomad.app/Alnomad

ld: warning: Auto-Linking supplied 'FacebookSDK/Bolts.framework/Bolts', framework linker option at FacebookSDK/Bolts.framework/Bolts is not a dylib Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_FBSDKHashtag", referenced from: objc-class-ref in libRCTFBSDK.a(RCTConvert+FBSDKSharingContent.o) ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

4

4 Answers

6
votes

I am recently doing the same thing on my react native project and I have spent quite some time to make it work too.

Your case seems to be that you did not include Bolts.framework, a dependency of the FBSDKCoreKit.framework, in your project folder. I believe that's the reason why the Facebook official doc recommends everyone to keep the SDK files in ~/Documents, so you don't miss dependency files, or having to duplicate these files on each of your project.

Below are some troubleshooting steps for anyone who is having issues with the integration:

1. Link react-native-fbsdk to your project. (Edit: As of lately, linking doesn't work with the SDK. According to @chez.mosey's answer below, you may follow steps in this blog to manually add the SDK to your project.)

rnpm link react-native-fbsdk

react-native link react-native-fbsdk

Edit: rnpm has been integrated into React Native since 1 Aug, 2016. From then on, use react-native link to link your dependencies.

The link function updates your project by linking all native dependencies, and in this case, we link react-native-fbsdk to the native FacebookSDK.

2. Add libRCTFBSDK.a to Build Phases -> Link Binary with Libraries in Xcode.

This should be automatically added when you run react-native link, but make sure it's there.

3. Import FacebookSDK framework files manually

Speaking from experience, if you are using Cocoapods to download the FBSDK framework files, Xcode won't build them along with libRCTFBSDK.a. Follow the steps in the official FB doc, download the files, unzip them to ~/Documents/FacebookSDK, and drag them to your Xcode project without copying them. Add the path to your framework search path. (If anyone knows the reason why Cocoapods won't work, I'm all ears)

4. Clean your Xcode project and delete derived data

Do that to avoid having the previously built files messing with your current settings.

2
votes

When you download FacebookSDK from (https://developers.facebook.com/docs/ios/) the folder will be named as FacebookSDKs-iOS-4.20.1. So, try renaming it to FacebookSDK.

Then clean and build your Xcode project again.

1
votes

Make sure to download and keep the FacebookSDK folder on your computer (https://developers.facebook.com/docs/ios/). I usually place it in ~/Documents/FacebookSDK and reference it from the build settings. This is in addition to dragging over the 3 framework files into the Frameworks folder.

1
votes

As others have suggested, make sure your follow all of the configuration steps for the SDK here: https://developers.facebook.com/docs/react-native/configure-ios/

After doing this, I encountered the issue mentioned in the Troubleshooting section, "If you get a build error like 'Warning: Native component for 'RCTFBLikeView' does not exist,' verify that libRCTFBSDK.a shows up in the Link Binary with Libraries section of your build target's Build Phases." Which I believe is the issue you are encountering.

The problem is, I didn't know how to resolve the fact that libRCTFBSDK.a wasn't showing up. Turns out, it was because react-native-fbsdk wasn't linking properly, and thus I had to link it manually, which I was able to do following the wonderful steps provided here: http://www.namvo.me/manual-setup-for-facebook-sdk-in-react-native/