I ran into this problem using BuddyBuild (another CI system), and solved it via the instructions linked on their documentation page here http://docs.buddybuild.com/docs/common-react-native-errors#section-error-fbsdksharekit-fbsdksharekit-h-file-not-found, in particular this section:
error: 'FBSDKShareKit/FBSDKShareKit.h' file not found
This is generally a result of an incorrectly configured repository with
regards to the location of FBSDK dependencies. If you take a look at:
https://github.com/facebook/react-native-fbsdk/blob/master/ios/RCTFBSDK.xcodeproj/project.pbxproj
You will notice that RCTFBSDK will look for dependencies in one of two
locations:
- ~/Documents/FacebookSDK
- $(PROJECT_DIR)/../../../ios/Frameworks
The second option is the correct option for continuous integration systems
like Buddybuild. In other words, you MUST place your FBSDK
dependencies under the "ios/Frameworks" folder in order for it to work
on a continuous integration system.
The problem is that as Viktor pointed out the CI system doesn't have a reference to your FacebookSDK
folder containing the required Frameworks, so you need to actually copy the Frameworks themselves into your project itself so that everything is contained in your repository. This is necessary because the RCTFBSDK
library expects to find the Frameworks that it requires in precisely the folder $PROJECT_ROOT/ios/Frameworks
within your project (see the BuddyBuild documentation), and if they're anywhere else it will freak out.
For clarity the steps that I took to get my build working were:
- Create the folder
$PROJECT_ROOT/ios/Frameworks
in my project (Frameworks
may not already exist)
- Copy the Facebook framework files from
~/Documents/FacebookSDK
into this new folder
- Reference the Frameworks in Xcode per the installation instructions on the fbsdk Github page.
Hope that this helps any future readers.