React-native-fbsdk: FBSDKShareKit/FBSDKShareKit.h file not found

Created on 1 Nov 2018  Â·  29Comments  Â·  Source: facebook/react-native-fbsdk

I have tried all ways:

  1. Download fresh version of Facebook SDK and save a Documents folder
    screenshot at nov 01 15-55-14
    screenshot at nov 01 15-56-23
  2. Add FBSDK[Core, Login, Share]Kit.framework from Documents/Facebook
    screenshot at nov 01 15-59-51
    SDK folder
  3. Add path to Framework Search Path
    screenshot at nov 01 16-02-09
  4. Also I have tried install via cocopods, and same issue

Most helpful comment

@rumbaa01 Try doing this in XCode (i have 10): go to RCTFBSDK.xcodeproj then build settings->framework search paths. And change ~/Documents/FacebookSDK to $(HOME)/Documents/FacebookSDK
It saved me a lot of time. Now it finally gets built.

All 29 comments

@rumbaa01 Try doing this in XCode (i have 10): go to RCTFBSDK.xcodeproj then build settings->framework search paths. And change ~/Documents/FacebookSDK to $(HOME)/Documents/FacebookSDK
It saved me a lot of time. Now it finally gets built.

@Helga108 Thank you very much! You save me~

It worked for me:
/Users/{user}/Documents/FacebookSDK

I've installed the react-native-fbsdk. I don't have the folder FacebookSDK in my Docs directory. Should some process installed it?

@mjstelly, Download the sdk in this link: https://developers.facebook.com/docs/ios/downloads
Then rename to FacebookSDK and move to the Documents folder. worked for me.

I went the pods route. Hoping that it resolves this issue. Thanks!

Sincerely,
Michael Stelly | M: +1.918.978.2000 Blog | LinkedIn | Github
On Dec 20, 2018, 3:55 PM -0500, fexx notifications@github.com, wrote:

@mjstelly, Download the sdk in this link: https://developers.facebook.com/docs/ios/downloads
Then rename to FacebookSDK and move to the Documents folder. worked for me.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

@rumbaa01 Try doing this in XCode (i have 10): go to RCTFBSDK.xcodeproj then build settings->framework search paths. And change ~/Documents/FacebookSDK to $(HOME)/Documents/FacebookSDK
It saved me a lot of time. Now it finally gets built.

Thank you. This worked for me. I didn't remove the old path. I just added the new path $(HOME)/Documents/FacebookSDK

@rumbaa01 Try doing this in XCode (i have 10): go to RCTFBSDK.xcodeproj then build settings->framework search paths. And change ~/Documents/FacebookSDK to $(HOME)/Documents/FacebookSDK
It saved me a lot of time. Now it finally gets built.

still not working

@adilvectorcoder did you clean the build folder after you made the change? In my case it was a required step since it tried to use the old build data even after I changed the path

still not working through already clean the build folder @reyalpsirc

@vuvantoan95 Well, to be honest, I changed to $(HOME)/Documents/FacebookSDK on both the RCTFBSDK.xcodeproj and my main project. Perhaps you only changed in one place and you have more occurrences of ~/Documents/FacebookSDK that you need to change?

Using $(HOME) works, BUT the setting resets anytime I do a react-native link, so it breaks on the next build in XCode. Super annoying!

Also, how does a relative ~ path differ from an absolute one? And why did it change recently?
~ worked perfectly in RN 57 or older, but not in 58 or newer..

@adilvectorcoder did you clean the build folder after you made the change? In my case it was a required step since it tried to use the old build data even after I changed the path

Thank you sir now its working :)

@Helga108 how stupid facebook is, thank you so much, i spent a month for this kind of shitty config

In my team, this literally breaks every day. Xcode might work one time but it will break right after someone links a package, or even looks at .xcodeproj

I'm having this issue too. I've tried everything listed here–– I've changed it on the RCTFBSDK.xcodeproj and my main project, I've cleaned the build folder after making the change, I've added the new path alone as well as on top of the old one and nothing works. Please advise!

Remember that the order of Framework Search Paths (RTCFBSDK.xcodeproj -> /TARGET and PROJECT/ -> Build Settings is important. I have added my FacebookSDK to new folder (APP)/ios/Frameworks, and am using paths $(PROJECT_DIR)/../../../ios/Frameworks/FacebookSDK to reach it from RTCFBSDK, that is referenced in node_modules.

My workaround! 🛠

_The problem with fixing it manually, is that it will "reset" your change every time you run yarn or react-native link_

Using https://www.npmjs.com/package/patch-package will do this automatically for you!

  • Open the file node_modules/react-native-fbsdk/ios/RCTFBSDK.xcodeproj/project.pbxproj in your editor
  • Replace ~/Document with $(HOME)/Documents. There should be 2 places in this file.
  • yarn add patch-package postinstall-postinstall -d
  • npx patch-package react-native-fbsdk
  • Add this to package.json
 "scripts": {
+  "postinstall": "patch-package"
 }

Done :) Never fix it manually from now on!

Thanks, everyone, in the end, I solved the issue just dragging and dropping FacebookSDK into the Libraries>RCTFBSDK.xcodeproj --> on the Build settings searched for Framework Search path

TO AVOID type error is better to drag and drop the complete folder.

RCTFBSDK.xcodeproj
Screen Shot 2019-05-03 at 4 01 39 PM

Global project
Screen Shot 2019-05-03 at 4 04 22 PM

Hi
when this issue will be finally fixed? I have to implement this solution with $(HOME)/Documents/FacebookSDK after each react-native link

@optimatex You can always fork the repository, change the file on your forked version and import it with npm/yarn

@reyalpsirc great idea, but wait, I need to do this with each library updates, so probably no thanks

@rumbaa01 Try doing this in XCode (i have 10): go to RCTFBSDK.xcodeproj then build settings->framework search paths. And change ~/Documents/FacebookSDK to $(HOME)/Documents/FacebookSDK
It saved me a lot of time. Now it finally gets built.

@Helga108 Believe me, you are a lifesaver. I have spent hours debugging this.

@rumbaa01 Try doing this in XCode (i have 10): go to RCTFBSDK.xcodeproj then build settings->framework search paths. And change ~/Documents/FacebookSDK to $(HOME)/Documents/FacebookSDK
It saved me a lot of time. Now it finally gets built.

@Helga108 Believe me, you are a lifesaver. I have spent hours debugging this.

and

@reyalpsirc great idea, but wait, I need to do this with each library updates, so probably no thanks

The problem with fixing it manually, is that it will "reset" your change every time you run yarn or react-native link, so you have to keep re-fixing it every time.

Please check my fix above to do it automatically for you :)

Thanks @kg-currenxie I’m lucky to have stumbled on this link. I’ve been on this for HOURS. I can at least close one eye when I sleep😅

My workaround! 🛠

_The problem with fixing it manually, is that it will "reset" your change every time you run yarn or react-native link_

Using https://www.npmjs.com/package/patch-package will do this automatically for you!

  • Open the file node_modules/react-native-fbsdk/ios/RCTFBSDK.xcodeproj/project.pbxproj in your editor
  • Replace ~/Document with $(HOME)/Documents. There should be 2 places in this file.
  • yarn add patch-package postinstall-postinstall -d
  • npx patch-package react-native-fbsdk
  • Add this to package.json
 "scripts": {
+  "postinstall": "patch-package"
 }

Done :) Never fix it manually from now on!

It worked for me, I just had to change the order because yarn add patch-package postinstall-postinstall -d overwritten the changes inside node_modules/react-native-fbsdk...

I have a different workaround as I don't like the idea that those frameworks would not end up in repo and new person would have to redownload them - stupid.

This is Framework Search Paths of the RCTFBSDK Project
Screenshot 2019-05-29 at 14 53 03

So you can utilise one of last two directories and put there framework files and viola.

I have a different workaround as I don't like the idea that those frameworks would not end up in repo and new person would have to redownload them - stupid.

This is Framework Search Paths of the RCTFBSDK Project
Screenshot 2019-05-29 at 14 53 03

So you can utilise one of last two directories and put there framework files and viola.

Agreed, I had the same problem, and while Importing the Framework files, I thought they were being imported to $(PROJECT_DIR)/../../../ios/Frameworks; they are instead imported to $(PROJECT_DIR)/../../../ios, so the simplest way is what you propose, import the files to the Frameworks subfolder

@rumbaa01 Try doing this in XCode (i have 10): go to RCTFBSDK.xcodeproj then build settings->framework search paths. And change ~/Documents/FacebookSDK to $(HOME)/Documents/FacebookSDK
It saved me a lot of time. Now it finally gets built.

thank you so much you save my time.

Was this page helpful?
0 / 5 - 0 ratings