react: 16.6.1 => 16.6.1
react-native: 0.57.4 => 0.57.4
I checked documentation here https://developers.facebook.com/docs/ios/getting-started/ and they said install sdk by cocoapods, so no more copy anything.
But in your documentation said:
Along with FBSDKCoreKit.framework, don't forget to import FBSDKShareKit.framework and FBSDKLoginKit.framework into your Xcode project.
What is the correct way of installation?
I've just spent a good couple of hours figuring this out for iOS and I can share how I did it..
I installed and linked react-native-fbsdk and this adds a line
pod 'react-native-fbsdk', :path => '../node_modules/react-native-fbsdk'
in Podfile which causes many problems (it install react-native version 0.11.0 for example).
There's also Facebook SDK which, when installed from cocoapods, I couldn't make work.
So I took another approach. I removed react-native-fbsdk line from Podfile and added only Facebook SDK pods:
pod 'FacebookSDK'
pod 'FBSDKShareKit'
pod 'FBSDKLoginKit'
I added 'react-native-fbsdk' by draging xcodeproj file from node_modules/react-native-fbsdk into the Libraries in XCode.
I then tweaked later Libraries->RCTFBSDK.xcodeproj settings, namely Framework Search Path which points to ~/Documents/FacebookSDK (not really sure why?). Also, make sure you added libRCTFBSDK.a in Link Binary With Libraries.
Hope this helps.
It works awasome! Thank you
Thanks a lot for your extensive write-up.
I then tweaked later Libraries->RCTFBSDK.xcodeproj settings, namely Framework Search Path which points to ~/Documents/FacebookSDK (not really sure why?).
How exactly did you tweak these settings? It's still not working for me
@dedan I just added correct paths to downloaded FacebookSDK library. I can look up how exactly if you still need it.
this version of the official docs worked for me (they have a lot of similar pages)
I'm still getting the error 'FBSDKCoreKit/FBSDKAppEvents.h' file not found even after adding everything to Podfile, Libraries and Link Binary With Libraries. Anyone has any idea how to resolve?
I'm still getting the error
'FBSDKCoreKit/FBSDKAppEvents.h' file not foundeven after adding everything toPodfile,LibrariesandLink Binary With Libraries. Anyone has any idea how to resolve?
same problem here.
Just to let you guys know, downgrading FBSDKCoreKit, FBSDKLoginKit and FBSDKShareKit to version 4.40.0 (instead of 4.42.0) works.
@ital0 can you please write the steps you perform to downgrade .... as i did specify the version in podfile explicitly and then run pod install ...but still the issue persist
@anwargul0x just pointed the version in Podfile:
pod 'FBSDKCoreKit', '~> 4.40.0'
pod 'FBSDKLoginKit', '~> 4.40.0'
pod 'FBSDKShareKit', '~> 4.40.0'
@ital0 thanks... I exactly did this early ...but it didn't work for me I guess I will have reinstall all pod dependencies
@ital0 .... i solved this issue by deleting node_modules and podfiles and pod folder.
then ran
npm install
cd ios
pod init
specified fbsdk in podfile as
pod 'FBSDKCoreKit', '~> 4.40.0'
pod 'FBSDKLoginKit', '~> 4.40.0'
pod 'FBSDKShareKit', '~> 4.40.0'
then finally
`pod install'
By the way instead of manually linking xcodeproj and adding libRCTFBSDK.a, you can rename or delete node_modules/react-native-fbsdk/react-native-fbsdk.podspecand then run
react-native link react-native-fbsdk, the same way it's suggested here https://github.com/react-native-community/react-native-google-signin/blob/master/docs/ios-guide.md
I'm trying to upgrade to the latest version of the library (0.10.1). Unfortunately, I am getting 'FBSDKCoreKit/FBSDKAppEvents.h' file not found error when I try to manually link the library as @zavadpe suggests. I removed react-native-fbsdk line from Podfile and manually dragged xcodeproj file from node_modules/react-native-fbsdk. I also added libRCTFBSDK.a to Link Binary With Libraries. My Podfile is as:
pod 'FBSDKCoreKit', '5.1.1'
pod 'FBSDKLoginKit', '5.1.1'
pod 'FBSDKShareKit', '5.1.1'
I am using React Native v0.59.8 and I tried all 5.0.0, 5.0.1, 5.0.2, 5.1.0 and 5.1.1 versions of FBSDK libraries.
As an alternative, I tried to link the library via CocoaPods as below. This time it builds fine, but I am getting null is not an object (evaluating 'AppEventsLogger.setUserID') JavaScript error.
rn_path = '../node_modules/react-native'
pod 'yoga', path: "#{rn_path}/ReactCommon/yoga"
pod 'React', path: rn_path, subspecs: [
'Core',
'CxxBridge',
'DevSupport',
'RCTActionSheet',
'RCTAnimation',
'RCTGeolocation',
'RCTImage',
'RCTLinkingIOS',
'RCTNetwork',
'RCTSettings',
'RCTText',
'RCTVibration',
'RCTWebSocket',
]
pod 'Folly', :podspec => "#{rn_path}/third-party-podspecs/Folly.podspec"
pod 'react-native-fbsdk', :path => '../node_modules/react-native-fbsdk'
@eraycetiner I'm getting the same issue... 'FBSDKCoreKit/FBSDKAppEvents.h' file not found.
Did you find any solution?here is my snippet of podfile
pod 'FacebookSDK'
pod 'FBSDKCoreKit', '5.0'
pod 'FBSDKLoginKit', '5.0'
pod 'FBSDKShareKit', '5.0'
@scaralfred Removing use_frameworks! from Podfile helped me.
@scaralfred Removing
use_frameworks!from Podfile helped me.
Exactly you'll want use_native_modules! instead because _react-native-fbsdk_'s implemented in Objective-C (not Swift).
Most helpful comment
I've just spent a good couple of hours figuring this out for iOS and I can share how I did it..
I installed and linked
react-native-fbsdkand this adds a linepod 'react-native-fbsdk', :path => '../node_modules/react-native-fbsdk'in Podfile which causes many problems (it install react-native version 0.11.0 for example).
There's also Facebook SDK which, when installed from cocoapods, I couldn't make work.
So I took another approach. I removed react-native-fbsdk line from Podfile and added only Facebook SDK pods:
I added 'react-native-fbsdk' by draging xcodeproj file from node_modules/react-native-fbsdk into the Libraries in XCode.
I then tweaked later Libraries->RCTFBSDK.xcodeproj settings, namely Framework Search Path which points to ~/Documents/FacebookSDK (not really sure why?). Also, make sure you added libRCTFBSDK.a in Link Binary With Libraries.
Hope this helps.