6

Try to install Facebook SDK to react natiove IOS.

I have FBSDKCoreKit/FBSDKCoreKit.h file not found error and spent several hours trying to solve it with different solutions, but can't understand whats going wrong((

Any ideas?

react-native 0.40 react-native-fsdk 0.5.0 facebook sdk: 4.19.0

Tony
  • 566
  • 2
  • 5
  • 16
  • You can find solution here with the details; https://stackoverflow.com/questions/30136279/fbsdkcorekit-fbsdkcorekit-h-not-found-error/48390222#48390222 – Rajan Maharjan Jan 22 '18 at 21:06
  • Possible duplicate of [FBSDKCoreKit/FBSDKCoreKit.h not found error](https://stackoverflow.com/questions/30136279/fbsdkcorekit-fbsdkcorekit-h-not-found-error) – Rajan Maharjan Jan 22 '18 at 21:20

6 Answers6

17

EDIT: I recommend using CocoaPods so you don't need to download/update the sdk manually.


If you downloaded the sdk manually, try this:

  1. Open your ~/Documents/FacebookSDK folder;

  2. Check if it has these cloud icons right of the filenames:

screenshot.png

If so, macOS removed your files from your computer and uploaded them to iCloud! (thanks Apple)

  1. Click on all the cloud icons, it will download the files back.

That's it!


If this isn't your case, try these:

Cœur
  • 37,241
  • 25
  • 195
  • 267
Bruno Lemos
  • 8,847
  • 5
  • 40
  • 51
  • 1
    I'm trying to use a CI build tool, however it is going off a combination of npm modules and what's in the github repository (where all of my other frameworks are located). Is it possible to move these sdks into the project structure and change framework search paths etc? It's the only way I can think to allow the build tool to actually build it as it doesn't have access to my documents folder. Thanks – Sam Matthews May 18 '17 at 14:10
14
  1. Check if you did react-native link on your RN project.
  2. Manually check in Linked Frameworks And Libraries, that you have libRCTFBSDK.a. If not, hit that + button at the bottom and link it.
  3. When upgrading the project itself react-native from <0.40 make sure you ran react-native upgrade after you've updated the RN package itself with npm install react-native@latest --save
  4. Make sure that you put sdk in ~/Documents/FacebookSDK. I think it's important.

If you come across some errors, sometimes it's better to clear all, and start fresh installation again.

Try:

rm -rf ./node_modules
watchman watch-dell-all
npm cache clean
npm install
react-native run-ios
Community
  • 1
  • 1
Tony
  • 566
  • 2
  • 5
  • 16
  • 6
    Can't believe that putting it in ~/Documents/FacebookSDK fixes the problem for me. I had it in some other directory previously. – Varun Gupta Feb 18 '17 at 16:22
  • 1
    yeah, that fixes. Unbelivable – Strong Bear May 08 '17 at 23:50
  • How can we use the sdk with SAAS build tools (e.g travis, buddybuild, etc)? Do we have to implement cocoapods in our app todo this? We're currently using carthage – James111 May 24 '17 at 07:57
  • @Tony. I know that according to FbSDK specification you should put it to the ~/Documents/FacebookSDK. But that is inconvenient because I can't put it on repository. Each developer should have it on ~/Documents/FacebookSDK. So, I've put it on /MyProject/FacebookSDK and I still have this issue. Any ideas? – valerybodak Aug 11 '17 at 12:22
  • for CI or CD see my answer here https://stackoverflow.com/questions/44236737/facebook-sdk-not-working-if-i-place-the-sdk-folder-inside-react-native-project/45642926#45642926 – jamesjara Aug 11 '17 at 19:59
  • dude u saved my day, thanks a lot, putting it in ~/Documents/FacebookSDK fixed the problem. putting it in ~/Documents/FacebookSDK is really really important – Gokul Kulkarni Aug 14 '17 at 05:34
  • @VarunGupta but where is Documents folder ?. don't have any document folder in react-native code. – Rushi trivedi Jun 22 '18 at 14:32
  • @Rushitrivedi The Documents folder in the Mac home directory. I don't know about Windows if you are using a Windows laptop. – Varun Gupta Jun 22 '18 at 19:09
12

Had this problem too but my issue was that RCTFBSDK specifically looks in the ~/Documents/FacebookSDK path with a non-recursive setting. To check if you have the same problem, open your Libraries folder and RCTFBSDK.xcodeproj folder. Check if the Frameworks are red

enter image description here

If they are, click on them and in the right sidepanel, change the location to where you store the SDK. I store my Facebook SDKs by version number so that was what caused the problem. For example, version 4.12 is stored in ~/Documents/FacebookSDK/4.12, so RCTFBSDK could not find the correct *.framework.

Also, click on the RCTFBSDK.xcodeproj and add ~/Documents/FacebookSDK with a recursive setting to the Framework Search Paths. It should compile without issues after this.

zephinzer
  • 1,077
  • 11
  • 9
  • Great solution. It is so strange but placing these 3 *.framework documnets into ~/Documents/FacebookSDK solved my problem. Thanks – David May 27 '18 at 17:26
6

For Xcode 10.x on your main project and on Libraries -> RCTFBSDK.xcodeproj use $(HOME)/Documents/FacebookSDK instead of ~/Documents/FacebookSDK under Build Settings -> Framework Search Paths.

Henry Orozco
  • 111
  • 2
  • 6
2

Check the location of your FBSDK file Path. My path ended up being Users/Documents/FacebookSDK

To check go to Library/RCTFBSDK.xcodeproj/Frameworks/

click on one of the frameworks on your file inspector window it shoulw have a section called Full Path

Take that path and add it to your Framework Search Paths.

jmFrmMIA
  • 21
  • 1
0

Wile Importing Please make sure the you are checking this.

enter image description here

When you Drag and Drop The Packages.