Build failing with file not found (FBSDK) in IOS build

I have installed the relevant FBSDK frameworks and set the framework search path. I can build the app locally and archive it but the archive step fails on Bitrise.

/Users/vagrant/git/node_modules/react-native-fbsdk/ios/RCTFBSDK/share/RCTFBSDKShareDialog.h:21:9: ‘FBSDKShareKit/FBSDKShareKit.h’ file not found

#import < FBSDKShareKit/FBSDKShareKit.h>

The framework search path is set to

$(PROJECT_DIR)/**

and I also have

$(SRCROOT)/Frameworks

The frameworks are in the repo (under ios/) but Bitrise keeps failing with file not found.

It seems you use npm to install the FB SDK - do you run npm install as part of your build config / workflow?

Yes, I have npm install set to run after the git clone

Can you please follow this guide How to debug your build locally / "It works on my Mac/PC but not on bitrise.io" and let us know how it goes?

I followed the steps. Did a clean clone of the repo and ran the CLI. The build passed on both primary and deploy workflows. But the deploy workflow still fails on the bitrise machine.

Please send us the related build’s URL or its log in email or through the onsite chat (Contact Support option).

I have used the onsite chat. Thanks for the help

Can you do one more clean git clone (delete the directory from /tmp or use another directory in /tmp - don’t reuse the previous one!) and run only the deploy workflow with the CLI there?

Please also make sure that you selected the same Xcode version on bitrise.io as the one you use locally!

I am using the same Xcode version. I did a new build of the deploy workflow from a new clone and it passed from the CLI, tried another build on the bitrise machine and that is still failing for deploy workflow

There’s something on your Mac what makes it pass - if the CLI passes locally, that’s exactly the same what happens on bitrise.io, the only difference is the environment, e.g. if you have files on your Mac which are not available on bitrise.io (because you did not commit it into your repo), or the tool versions.

I wonder, can it be maybe an NPM/Node version difference? It seems you used the Xcode 8.0 stack on bitrise.io, which has an older Node version preinstalled, although I’m not sure if this is related. The error is code related:

❌  /Users/vagrant/git/node_modules/react-native-fbsdk/ios/RCTFBSDK/share/RCTFBSDKShareDialog.h:21:9: 'FBSDKShareKit/FBSDKShareKit.h' file not found

#import <FBSDKShareKit/FBSDKShareKit.h>
                 ^ ~~~~~~~

It seems that the FB SDK is simply not at the path your project configs expect it.

Now that I tried to search for the error, did you create this StackOverflow question? : http://stackoverflow.com/questions/41749205/react-native-fbsdk-file-not-found-on-ci

If you did, then it seems locally on your mac you have the FB SDK at ~/Documents/FacebookSDK, while on Bitrise.io you don’t. If your project is configured to look for the FB SDK at ~/Documents/FacebookSDK you should download the FB SDK there on bitrise.io too.

This would actually explain why it worked on your Mac regardless where you git cloned the repository, as ~/Documents/FacebookSDK will always be at the same place (~ means the “HOME” directory), while on bitrise.io it seems you don’t download the FB SDK there (from your logs it seems).

Yes, I did create that question but it is a bit outdated. I removed the reference to the documents folder and replaced it to look up the frameworks in the correct place. However, I have since removed the SDK from my documents folder and can see the build failing locally via the CLI. Seems there must still be a reference to it somewhere.

Will track it down. Thanks for the help

1 Like

Yeah, I think this is not a configuration in your code, more likely in a component you install through NPM, which expects the FB SDK to be at ~/Documents/FacebookSDK, at least from the log it seems to be the case.

Please let us know if you can figure out what causes this issue! At least you can now reproduce this on your own Mac, that should help :wink:

I have finally got it working. The issue was indeed linking. The FBSDK npm module had a setup script inside it to download the frameworks and link them. It didn’t work but after reading through the code of the script I was able to link them. They were set up to link to ios/Frameworks, however, that folder isn’t the Frameworks folder that is displayed in Xcode, it is another folder which I found using the Finder. I put the frameworks in there and they are linked up now. Deploy workflow is passing now.

Thanks for the help Viktor.

1 Like

Any time :wink:

Thanks for sharing the solution, it’ll definitely help others in the future!

Hi Carl,

I was not able to find ios/Frameworks folder. I saw it is supposed to be at $(PROJECT_DIR)/…/…/…/ios/Frameworks but I can’t find it in my React Native project although I used Frameworks. Could you please tell me how to find the folder?

Hi @kyawmoehein,

Can you please follow this guide How to debug your build locally / "It works on my Mac/PC but not on bitrise.io" and let us know how it goes?

Hi there,
I’m running into the exact same issue right now and I may like for a little more details on what you have done to figure it out.
You say : “They were set up to link to ios/Frameworks, however, that folder isn’t the Frameworks folder that is displayed in Xcode, it is another folder which I found using the Finder” but could you tell me which are the exact paths you had to change and where please ?
Because today, the ios_setup.js in the node_modules folder is targeting a “./ios/Frameworks/…” which is not the path of the xcode projet which is outside of the node_modules folder (ROOT/ios/Frameworks/…).
And I can not put the FBSDK Framework inside “node_modules/react-native-fbsdk/ios/Frameworks” folder because node_modules is not tracked by git like expected and I guess it will not change anything during the bitrise build :).
Can you help me please ?

Thanks.

Where is is on your Mac? And how do you install the (the FB SDK)?

Hi and thanks for the quick response.
The FBSDK is in two locations on my Mac. Into “~/Documents/FacebookSDK” like asked by the React-Native tutorial and into “/Users/{home}/{reposFolder}/{project}/ios/Frameworks/FacebookSDK”. We put the FBSDK into the second location to make the bitrise build works.

And we give to Xcode Framework Search Paths the second location too.