React-native-fbsdk: Cannot find iOS FB SDK

Created on 22 May 2016  路  9Comments  路  Source: facebook/react-native-fbsdk

Hey there,

I'm trying to install react-native-fbsdk v0.2.0 and getting errors with iOS FB SDK:
node_modules/react-native-fbsdk/iOS/RCTFBSDK/core/RCTFBSDKAppEvents.h:21:9: 'FBSDKCoreKit/FBSDKCoreKit.h' file not found. Sometimes I see errors about ShareKit.
I'm trying this in brand new project with RN v0.26.1.
My package.json
"dependencies": { "react": "^15.0.2", "react-native": "^0.26.1", "react-native-fbsdk": "^0.2.0" }

This is screenshot of rnpm succeed
screen shot 2016-05-22 at 6 08 09 pm
Screenshots of project:
screen shot 2016-05-22 at 6 09 20 pm
screen shot 2016-05-22 at 6 10 18 pm
screen shot 2016-05-22 at 6 11 15 pm

Could you please help figure out what's wrong.

Most helpful comment

@dzhuowen , You're aware that your decision to depend on code _outside_ of the source code tree now means:

  • the build is non-hermetic, and not dependent on what is checked into source control for my source repo
  • depends on what version a user happens to have installed in their ~/Documents/ directory, which means losing reproducible builds copying the source tree from one machine to another
  • makes it impossible to upgrade the FB SDK across an organization (since you can't do an atomic commit to a config file to trigger it to upgrade their ~/Documents directory)
  • means I now need to upgrade _all_ react-native projects _simultaneously_ for any new FB SDK updates, instead of updating any given project to deal with compatibility changes individually

This design seems to violate a number of software engineering best practices.

Yes, rnpm is great, and I use both it and CocoaPods in my project. My attempt at debugging why the compiler said 'quote' wasn't found in FBSDKShareLinkContent, proved very difficult, as I had assumed all code dependencies would be inside my source tree. (Turns out, I had a very old version of FacebookSDK installed in my ~/Documents directory from last year, and I had no idea I was depending on it.)

I suspect you'll need to find a better solution to this problem, as these kinds of complaints are going to become worse as more people run into this. You could include the FB SDK inside react-native-fbsdk itself. Or you could have react-native-fbsdk depend on a dummy fbsdk npm that contains the FB code, which could be updated independently. I personally liked the CocoaPods approach of having a numbered version FB SDK that I was referencing from a Podfile.lock that guaranteed reproducible builds....but if you don't want CocoaPods, I'll leave it to you to figure out a better solution that doesn't have all of the problems I mentioned above.

All 9 comments

This is b/c build target RCTFBSDK is set to search framework in ~/Documents/FacebookSDK so it doesn't know about the SDK in $(PROJECT_DIR)/elibs/FacebookSDK.
There're two ways to solve this,

  1. Set the Framework search path of testapp to ~/Documents/FacebookSDK and put the iOS SDK there.
  2. Change the Framework search path of build target RCTFBSDK to $(PROJECT_DIR)/elibs/FacebookSDK.

@dzhuowen it's quite weird decision to get rid of cocoapods. What decided it?
Now every developer should place libs somewhere in ~/ or change path to fb sdk in lib settings. $(PROJECT_DIR)/elibs/FacebookSDK doesn't work, cause $(PROJECT_DIR) leads to node_modules/ directory.

Thanks for response, @dzhuowen!

The reason we drop support for cocoapods is b/c 1) rnpm is more popular in the react-native community and the setup is much easier comparing to cocoapods. For example, no more creating pod file, removing static libraries from xcode project files and linker flag setup; 2) If the developer doesn't use cocoapods at the early stage, it's hard to switch to using it, especially for projects with additional dependencies.

If you put the iOS SDK in a fixed location like ~/Documents/FacebookSDK, you can use this sdk for all you react-native projects without keeping multiple copies of the SDK in your local, right?

@dzhuowen , You're aware that your decision to depend on code _outside_ of the source code tree now means:

  • the build is non-hermetic, and not dependent on what is checked into source control for my source repo
  • depends on what version a user happens to have installed in their ~/Documents/ directory, which means losing reproducible builds copying the source tree from one machine to another
  • makes it impossible to upgrade the FB SDK across an organization (since you can't do an atomic commit to a config file to trigger it to upgrade their ~/Documents directory)
  • means I now need to upgrade _all_ react-native projects _simultaneously_ for any new FB SDK updates, instead of updating any given project to deal with compatibility changes individually

This design seems to violate a number of software engineering best practices.

Yes, rnpm is great, and I use both it and CocoaPods in my project. My attempt at debugging why the compiler said 'quote' wasn't found in FBSDKShareLinkContent, proved very difficult, as I had assumed all code dependencies would be inside my source tree. (Turns out, I had a very old version of FacebookSDK installed in my ~/Documents directory from last year, and I had no idea I was depending on it.)

I suspect you'll need to find a better solution to this problem, as these kinds of complaints are going to become worse as more people run into this. You could include the FB SDK inside react-native-fbsdk itself. Or you could have react-native-fbsdk depend on a dummy fbsdk npm that contains the FB code, which could be updated independently. I personally liked the CocoaPods approach of having a numbered version FB SDK that I was referencing from a Podfile.lock that guaranteed reproducible builds....but if you don't want CocoaPods, I'll leave it to you to figure out a better solution that doesn't have all of the problems I mentioned above.

I'm using cocoapods too, how do I link rn fbsdk to my pods?

@dzhuowen I also agree that ~Documents is not the right place. If you work in a team do you ask everyone to install FBSDK in their Documents directory, also what if I need different versions of the SDK for different projects? I would just expect to git clone the project and start working with it.

Totally agree with @mikelambert @knowbody
I used cocoapods and CI server. How you guys imagine people should manually install fb sdk in home directory on CI server every time?

It's better to create new issue to discuss this. This library is for people, so let's be in touch with other developers who are using this library.

Great points, I'm going to move this conversation to https://github.com/facebook/react-native-fbsdk/issues/181 as I think the specific report was fixed for @mtven

Was this page helpful?
0 / 5 - 0 ratings