FBSDKCoreKit/FBSDKCoreKit.h not found error

IosFrameworks

Ios Problem Overview


I am implementing FB Login so i Downloaded the SDK from https://developers.facebook.com/docs/ios. then i drag n down FBSDKCoreKit, FBSDKLoginKit and FBSDKShareKit frameworks into my project.

when i ran project it works fine. but when i closed and reopen it, then "FBSDKCoreKit/FBSDKCoreKit.h not found error" appears. then again i copy paste FBSDKCoreKit framework into my project's library and error disappear and this process continues. anyone faced this problem before?

what should i do to solve this error?

Ios Solutions


Solution 1 - Ios

Make sure to follow this step:

Deselect Copy items into destination group's folder. https://developers.facebook.com/docs/ios/getting-started/

Also, in your Build Settings, look at this field: "Framework Search Paths" You should have something like this:

/Users/[username]/Documents/FacebookSDK

or for a more general config

~/Documents/FacebookSDK

Also, look at Finder and make sure that the framework is actually there

Solution 2 - Ios

After updating Cocoapods 1.0.0, I deleted pod.lock and installed the current stable pod versions (4.7.0 to 4.11.0) of FBSDKCoreKit, FBSDKLoginKit, FBSDKShareKit

Then i encounter the same error. What i did was:

  1. Added Header Search Paths Build Settings in Xcode:

     "${PODS_ROOT}/Headers/Public/Facebook-iOS-SDK\"
     "${PODS_ROOT}/Headers/Public/Facebook-iOS-SDK/FacebookSDK\"
     "${PODS_ROOT}/Headers/Public/FBSDKCoreKit\"
     "${PODS_ROOT}/Headers/Public/FBSDKCoreKit/FBSDKCoreKit\"
    

Then i still had error for another file. Because XCode is using prebuild frameworks.

> FBSDKCoreKit/FBSDKCopying.h not found

  1. Clean Build -> ⇧⌘K (Shift + Command + K) - to clean builded frameworks.

  2. Clean Build Folder -> ⌥⇧⌘K (Option+Shift+Command+K)

  3. Close Xcode // important! - Otherwise it recreate the DerivedData for the current open project automatically

  4. Run this command in terminal

     rm -rf ~/Library/Developer/Xcode/DerivedData
    
  5. Open XCode and build successfully

Solution 3 - Ios

I got to solve this by deleting the Framework and adding it again by right click on the project->Add files..., then choose the framework and SELECT the option to Copy files if needed. I know it's not what Facebook recommends, but I couldn't make it work doing that, but this way it worked! I'm using v4.6 of FBSDK and Xcode 7 beta 6. Hope it helps you and everyone else who's facing the same problem :)

Solution 4 - Ios

This also took me hours of pain! Finally I found the root problem.

The Facebook SDK MUST be located at ~/Documents/FacebookSDK

This is because in the RCTFBSDK project this path is hardcoded. But you can add your custom location by adding it to the Framework Search Paths of the RCTFBSDK project (it will be shown in the error console)!

Solution 5 - Ios

FB developers say don't select copy files. Which creates problem. But I did opposite.

  1. I selected copy items if needed. It copied Frameworks in my project. Also automatically Search Path was added by xcode 7.2.

  2. Also double check if there is nothing in Framework Search Pathsunder Search Paths under Build Settings fields, then just add $(PROJECT_DIR) which is equal to /Users/user/Documents/....PROJECT..DIR...

Compiled in 2 projects successfully.

Solution 6 - Ios

I had to move FacebookSDK path in Framework Search Paths above $(PROJECT_DIR)

$(SRCROOT)/../../../Documents/FacebookSDK
$(inherited)
$(PROJECT_DIR)

Solution 7 - Ios

Xcode 11 + CocoaPods solution

In root of your project, i.e. the same path where you have MyApp.xcworkspace open Terminal and init pod's pod init, then add the required FBSDK pods - your Podfile should look something like that:

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'MyApp' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for MyApp
  pod 'FBSDKCoreKit'
  pod 'FBSDKLoginKit'
  pod 'FBSDKShareKit'	
end

Now in your Terminal pod install and open MyApp.xcworkspace (which is not MyApp.xcodeproj). Go to MyApp -> Build Phases -> Link Binary with Libraries and you should see at the bottom of the list of frameworks Pods_MyApp.framework. If you'd click + below Pods_MyApp.framework you should in new window below Workspace a list of Pods where all related to FBSDK should be.

Note: Make sure you're installing FBSDK, not Facebook SDK, because the second one is outdated.

Solution 8 - Ios

If any of the above answers didn't work, try this:

Open your ~/Documents/FacebookSDK folder. Check if there is this cloud icon right of the filenames:

screenshot.png

If so, macOS removed your files from your computer and uploaded them to iCloud! (thanks Apple)

You can:

  1. Click on all the cloud icons, it will download the files back
  2. Disable Storage Optimization on your mac to prevent it from happening again

Solution 9 - Ios

Solution to the problem if your FacebookSDK is different than

> ~/Documents/FacebookSDK

Because you don't want iCloud Drive to load up with FacebookSDK; you have to change the "Framework Search Paths" for the added

> react-native-fbsdk

This is because in the RCTFBSDK.xcodeproj inside Libraires; path is hardcoded. But you can add your custom location by adding it to the Framework Search Paths of the RCTFBSDK project.

  1. Select the Project
  2. Libraries
  3. Select "RCTFBSDK.xcodeproj"
  4. Build Settings
  5. Add your custom path in "Framework Search Paths" eg: /Users/rajanmaharjan/FacebookSDK
  6. Clean Build -> ⇧⌘K (Shift + Command + K) - to clean build frameworks.
  7. Build the project; it should build successfully.

Solution 10 - Ios

> For React Native devs:

Recommended steps to be done :

> 1.Make sure that the Facebook SDK frameworks are installed in ~/Documents/FacebookSDK.

> 2)Make sure that FBSDK[Core, Login, Share]Kit.framework show up in > the Link Binary with Libraries section of your build target's Build > Phases.

3)Make sure Framework Search Path of your build target's Build Settings is

$(HOME)/Documents/FacebookSDK

instead of

~/Documents/FacebookSDK 

If it still doesn't work for you then:

1)sudo chmod -R 755 ~/Documents/FacebookSDK

  1. set the path of framework search path of RCTFBSDK.xcodeproj to

    $(HOME)/Documents/FacebookSDK

(under libraries of your project folder ) set RCTFBSDK framework searchpath as here

> clean your project (command+ shift + k ) and build.

Solution 11 - Ios

I had the same problem. I fixed it by using quotes around my framework search path value i.e. "/Users/.....". Obviously, I have some spaces in my file paths.

Solution 12 - Ios

I have the same issue.I use Facebook SDK version 4.10.0.
I known my solution is not good but worked for me. I changed the Facebook source code. Changed the import file path from #import <FBSDKCoreKit/FBSDKCoreKit+Internal.h> to #import <FBSDKCoreKit/Internal/FBSDKCoreKit+Internal.h>

Solution 13 - Ios

Using CocoaPods, the only thing that worked for me was:

  1. Update Header Search Paths ( NOT Framework Search Paths ) under Build Settings in Xcode:

    - "\"${PODS_ROOT}/Headers/Public/Facebook-iOS-SDK\"",

    - "\"${PODS_ROOT}/Headers/Public/Facebook-iOS-SDK/FacebookSDK\"",

    + "\"${PODS_ROOT}/Headers/Public/FBSDKCoreKit\"",

    + "\"${PODS_ROOT}/Headers/Public/FBSDKCoreKit/FBSDKCoreKit\"",

  2. Add the missing header(s?):

    cd Pods/Headers/Public/FBSDKCoreKit/FBSDKCoreKit/ && ln -s ../../../../FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/Internal/FBSDKCoreKit+Internal.h FBSDKCoreKit+Internal.h

Edit: point 2. needs apparently to be repeated after each following call to pod install.

Solution 14 - Ios

For Xcode 7.3, the below worked for me. Follow the steps mentioned on FB's guide and additionally do the below:

step 1. go to Document/FacebookSDK folder

step 2. Click FBSDKCoreKit.framework

step 3. In this folder Remove Modules folder and then drag and drop in your Xcode Project.

References : https://stackoverflow.com/a/29532202

Thanks

Solution 15 - Ios

For people moving from Carthage to Cocoapods make sure to remove the Carthage references of the FBSDKCoreKit from the Link Binary With Libraries under Build Phases option.

enter image description here

Solution 16 - Ios

I had a similar issue, and could not resolve the compiler error anyway.

I followed and performed the exact integration steps a few times, until I noticed that I have a copy of the FBSDKCoreKit.framework inside my project folder (happened probably by a mistake). In addition the Framework Search Paths already contains $(PROJECT_DIR) besides /Users/{username}/Documents/FacebookSDK.

So I've removed the copy of the FBSDKCoreKit.framework from the project's directory and now everything works fine.

Solution 17 - Ios

I ran into this issue last night, and wanted to post my solution just in case someone else has the same problem. My problem was my app was building and running fine in the sim and on my device, however the build would fail because of FBSDKCoreKit whenever I tried to run my unit tests. It took my about 30 minutes to find the problem, and I felt like a dummy when I did.

Make sure that the FBSDKCoreKit bundle is targeted for your tests as well, and not just your regular application build.

Solution 18 - Ios

I had this problem when upgrading to Xcode 8 and was able to solve it by changing

#import <FBSDKCoreKit / FBSDKCoreKit.h>

to

#import <FBSDKCoreKit/FBSDKCoreKit.h>

Solution 19 - Ios

When you add the directory to your Build Settings -> "Framework Search Paths", make sure you add it to both Debug AND Release.

Silly error but if you're new to iOS dev in xcode you could miss this.

Solution 20 - Ios

Personally I had trouble with spaces in various paths, including app name. Removing spaces (or adding "" everywhere to secure paths) solved the problem.

Solution 21 - Ios

I had similar issue. Fix consisted for me in selecting: "COPY FILES IF NECESSARY" when manually adding the different frameworks into XCode framework.

Solution 22 - Ios

I dragged the framework to the Framework folder inside xcode, chose to copy files if needed and all worked fine without any other configuration change.

Solution 23 - Ios

I have installed react-native-fbsdk and link using react-native-link react-native-fbsdk.

Follow instruction of following link

https://developers.facebook.com/docs/react-native/configure-ios

This provide to link react-native library using ios_setup.js There are following step which i have followed.

  1. Setup on facebook developer account.

  2. Install the file ios_setup.js by executing the following command in a command prompt at your project's root folder.

curl -O https://raw.githubusercontent.com/facebook/react-native-fbsdk/master/bin/ios_setup.js

  1. Install the plist package, the xcode package, and the adm-zip package, by executing the following command. npm install plist xcode adm-zip
  2. Run the script ios_setup.js by executing the following command, and insert your app's App ID and App Name. If the name of your app is more than one word long, then enclose it between quotation marks.

node ios_setup.js [App ID] [App Name]

When run node ios_setup.js it wll automatically link all files in ios.

Solution 24 - Ios

After troubleshooting using several answers here. This is what I did.

  1. I changed ~/Documents/FacebookSDK to "$(HOME)/Documents/FacebookSDK" note: I used quotes "
  2. I moved "$(HOME)/Documents/FacebookSDK" to the top of the list in header search paths.

Solution 25 - Ios

Had a same error in FBSDKLoginKit

If you use multiple pod projects

install! 'cocoapods',
  :generate_multiple_pod_projects => true

Then you should force cocoapods to put all of FBSDK pods into a same project to make private headers visible

pod 'FBSDKCoreKit', '5.11.0', :project_name => 'FBSDK'
pod 'Bolts', '1.9.0', :project_name => 'FBSDK'
pod 'FBSDKShareKit', '5.11.0', :project_name => 'FBSDK'
pod 'FBSDKLoginKit', '5.11.0', :project_name => 'FBSDK'

Solution 26 - Ios

->Builds Configuration.

     -> Framework Search paths.

put the FacebookSDK directory in my case ~/Documents/FacebookSDK in :

Debugging,

Any architecture I Any Sdk,

Release.

especially this error because there no path in Any architecture I Any Sdk in my case

~ / Documents / FacebookSDK and it should be noted that the FacebookSDK folder must be in Domuments

Example

https://photos.app.goo.gl/5bD4d39a11AalYsx1

Solution 27 - Ios

Change the /Users/[username]/Documents/FacebookSDK/ directory to Documents/FacebookSDK like so:

xcode

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionM SwapnilView Question on Stackoverflow
Solution 1 - IosetayluzView Answer on Stackoverflow
Solution 2 - IosMihriban MinazView Answer on Stackoverflow
Solution 3 - IosmaufadelView Answer on Stackoverflow
Solution 4 - IosappsthatmatterView Answer on Stackoverflow
Solution 5 - IoskaranView Answer on Stackoverflow
Solution 6 - Iosuser9728668View Answer on Stackoverflow
Solution 7 - IosDaniel DanieleckiView Answer on Stackoverflow
Solution 8 - IosBruno LemosView Answer on Stackoverflow
Solution 9 - IosRajan MaharjanView Answer on Stackoverflow
Solution 10 - Iosishab acharyaView Answer on Stackoverflow
Solution 11 - IosRishad Meher-HomjiView Answer on Stackoverflow
Solution 12 - IostbagoView Answer on Stackoverflow
Solution 13 - IosFran PuglView Answer on Stackoverflow
Solution 14 - IosiCodeAtAppleView Answer on Stackoverflow
Solution 15 - Iosfootyapps27View Answer on Stackoverflow
Solution 16 - IoschoofieView Answer on Stackoverflow
Solution 17 - IosJacob BoydView Answer on Stackoverflow
Solution 18 - IosTheJediCowboyView Answer on Stackoverflow
Solution 19 - IosFrederickCookView Answer on Stackoverflow
Solution 20 - IosBenjamin PietteView Answer on Stackoverflow
Solution 21 - IostiofabbyView Answer on Stackoverflow
Solution 22 - Iosuser5162677View Answer on Stackoverflow
Solution 23 - IosSunil Kumar YadavView Answer on Stackoverflow
Solution 24 - IosKarl TaylorView Answer on Stackoverflow
Solution 25 - IosTimView Answer on Stackoverflow
Solution 26 - IosAlex YunganView Answer on Stackoverflow
Solution 27 - IosDanView Answer on Stackoverflow