sookool99
sookool99

Reputation: 262

react-native-fbsdk FBSDKCoreKit and FBSDKShareKit not found

I have installed the facebook SDK properly. (This is different from the other not found error because it is specifically for react-native-fbsdk and none of the solutions worked.)

I have tested that I have the SDK installed by importing both the FBSDKCoreKit header and FBSDKShareKit header into AppDelegate.m and it compiled and ran with no issue.

However when I installed react-native-fbsdk and linked it and compiled, I get the error of 'FBSDKCoreKit/FBSDKCoreKit.h' not found. similarly with FBSDKShareKit.

The troubleshooting on the github page gives 3 options to check when this occurs:

  1. Make sure that the Facebook SDK frameworks are installed in ~/Documents/FacebookSDK.

  2. Make sure that FBSDK[Core, Login, Share]Kit.framework show up in the Link Binary with Libraries section of your build target's Build Phases.

  3. Make sure that ~/Documents/FacebookSDK is in the Framework Search Path of your build target's Build Settings.

Which I have checked and verified that I had all of these there was no solution found. The strange thing is that I can import them in AppDelegate.m and it works fine.

Upvotes: 1

Views: 5383

Answers (3)

whtlnv
whtlnv

Reputation: 2217

If you are like me and don't want to do what Facebook tells you (or you don't want to put random stuff on your Documents folder):

  1. Replace every instance of ~/Documents/FacebookSDK in the QuickStart tutorial with the place you do want to store the SDK, in my case ~/Library/FacebookSDK. That means, unzip the downloaded SDK there and add that route to your project's Framework Search Paths. *
  2. In Xcode's file tree, expand the Libraries group and click on RCTFBSDK.xcodeproj. On that project click Build Settings and add your route to its Framework Search Paths.

And that's it. Just remember you did this when you update the node module, 'cause this change won't be versioned on your project.

*Note: If there are other people working on the project, do not remove ~/Documents/FacebookSDK from your project's Framework Search Paths. This is to be consistent with the module installation and the rest of the team can easily npm install and use the installation guide as documentation.

Upvotes: 1

Tareq
Tareq

Reputation: 71

You need to make sure you have the SDK frameworks saved under the folder ~/Documents/FacebookSDK

Because react-native-fbsdk iOS project have the value "~/Documents/FacebookSDK" hardcoded in its own definition of Framework Search Paths

Upvotes: 2

rigobcastro
rigobcastro

Reputation: 1257

Drag & drop in Xcode the FacebookSDK files, for example try with FBSDKCoreKit.h

Upvotes: 0

Related Questions