Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build error: FBSDKShareKit.h file not found after upgrading to Xcode 10

I'm building an app using react native that uses FBSDK (react-native-fbsdk). The whole thing worked without an issue, but after I update my Xcode from 9.4 to 10.0, I'm no longer able to build the project due to error:

'FBSDKShareKit/FBSDKShareKit.h' file not found

I've found a number of questions that seems to be having the same issue and tried their suggestion, but still can't build successfully. Things I've tried:

  1. Adding "~/Documents/FacebookSDK" to Framework Search Path
  2. Make sure FBSDK[Core, Share, Login]Kit.framework and libRCTFBSDK.a are in Link Binary with Libaries
  3. Using "rm -rf ~/Library/Developer/Xcode/DerivedData" to clean data then tried to build again
  4. Removing the Frameworks from FacebookSDK folder then added them again

At this point, I'm not sure what else I should try. The weirdest thing is that it was working before updating Xcode, so does that mean there's a change in Xcode itself that caused this?

Anyone have any idea on this or have faced this issue?

EDIT: I've managed to successfully build the project by changing the Build System from New Build System to Legacy Build System. The app now runs (maybe there's something changed in the way Xcode build projects now that's incompatible with the current fbsdk?)

like image 622
rabbit87 Avatar asked Sep 20 '18 05:09

rabbit87


2 Answers

I finally managed to build the project while setting the Build System to New Build System by adding in

$(PROJECT_DIR)/../../../ios

into RCTFBSDK's (target) Framework Search Paths.

My guess is that; due to the .frameworks file is located in ios folder instead of ios/Frameworks, the project can't find the necessary file. (Why it works if I used Legacy Build System is still a mystery to me).

I've tested in both emulator and device; both seems to be working fine.

like image 57
rabbit87 Avatar answered Oct 14 '22 03:10

rabbit87


What worked for me:

I created a Frameworks folder in the ios folder and moved all the fdsdk file into.

Then I had to remove FBSDK[Core, Share, Login]Kit.framework and libRCTFBSDK.a from "Link Binary with Libraries" (you access it in your project then build Phases) then add the 3 FBSDK[Core, Share, Login]Kit.framework again from the Frameworks folder + libRCTFBSDK.a

I cleaned the derivedData folder

rm -rf ~/Library/Developer/Xcode/DerivedData

Then the build was successful with the new build system.

Hope this may help other people.

Thanks @rabbit87 and @kalid for their help

like image 4
Pierre Avatar answered Oct 14 '22 02:10

Pierre