FBSDKCoreKit/FBSDKCoreKit.h not found error
Asked Answered
P

28

88

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?

Phosphide answered 9/5, 2015 at 5:11 Comment(7)
had you setup your .plistGrewitz
yes, with FB ID, Name and URL typePhosphide
@MSwapnil Have you found solution for this ?Benue
@Meenu Yes... Check your framework search path.Phosphide
@MSwapnil I am using Pods , I have installed Bolts pod too. but still , above issue is happening...Benue
@Benue did you find a solution for that? I'm also using PodsRespect
I had similar issue. I have answered in following link. https://mcmap.net/q/242843/-react-native-fbsdk-in-iosHemimorphite
H
94

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

Hierarch answered 9/5, 2015 at 5:37 Comment(11)
Deselect or select copy items into folder??Phosphide
Deselect - NOT selectHierarch
Add /Users/{username}/Documents/FacebookSDK to the project's Framework Search Paths in Xcode's Build Settings. got fixedJabber
I had the same issue, but I also hadn't renamed the SDK from "FacebookSDKs-iOS-20151111" to "FacebookSDK"...Monoplegia
I think it should be: ${HOME}/Documents/FacebookSDKPurview
Deselect Copy items into destination group's folder. ^-- he mean after drag and drop to framework folderNectar
second @Monoplegia above, hadn't renamed the folder >_<Demise
Why need to rename to FacebookSDK and exactly need be in Documents folder?Seaward
Make sure that your project doesn't have an empty space in its name. Framework search paths weren't able to detect the file for me if there was an empty space in the name inside the path!Unwritten
Apparently it must be in the exact location ~/Documents/FacebookSDK.Orpiment
Yes, that was the case because the location path was hardcoded in the RCTFBSDK.xcodeproj inside the library folder; So if you want the folder custom path with custom folder name; #30136779Czechoslovak
L
66

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

Lodmilla answered 19/5, 2016 at 16:36 Comment(5)
This actually worked. Thanks! Would you care elaborating why it does?Novikoff
this is the solution!Estate
Works great, I also did not change anything on Header Search Paths.Corlisscorly
I skipped 1,2,3,4,5, but instead, I just went outside and had lunch. And it worked! Thanks!!Ceric
:D hahaha @user345Lodmilla
G
33

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 :)

Gruchot answered 2/9, 2015 at 23:33 Comment(1)
but this is definitely for the wrong path reference, make it sure it exists in the /User/mike/Documents/FacebookSDK not in downloads folder neither with a version on it like FacebookSDK1.1.x You answer is much helpful though, it is guaranteed to work.Mcnutt
A
16

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)!

Alcock answered 23/1, 2017 at 18:5 Comment(1)
For whatever reason I had to use System Framework Search Paths instead of Framework Search PathsEdom
J
8

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.

Jaret answered 23/2, 2016 at 6:50 Comment(0)
L
6

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

$(SRCROOT)/../../../Documents/FacebookSDK
$(inherited)
$(PROJECT_DIR)
Lawler answered 2/5, 2018 at 5:57 Comment(0)
E
4

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.

Ethnography answered 9/11, 2019 at 14:7 Comment(0)
T
3

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
Thordia answered 4/2, 2017 at 13:20 Comment(0)
C
3

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.
Czechoslovak answered 22/1, 2018 at 21:2 Comment(0)
Z
3

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

2) 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.

Zettazeugma answered 16/1, 2019 at 13:28 Comment(0)
W
2

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.

Worsham answered 7/1, 2016 at 10:11 Comment(0)
L
2

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>

Lactate answered 3/3, 2016 at 1:55 Comment(0)
P
1

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.

Potable answered 11/2, 2016 at 15:18 Comment(0)
A
1

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

Affliction answered 12/5, 2016 at 13:2 Comment(0)
T
1

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

Thermistor answered 27/7, 2017 at 5:47 Comment(0)
T
0

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.

Text answered 6/12, 2015 at 19:42 Comment(0)
C
0

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.

Cognac answered 13/7, 2016 at 12:2 Comment(0)
O
0

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>

Ornie answered 1/12, 2016 at 22:27 Comment(0)
A
0

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.

Amundson answered 21/7, 2017 at 20:26 Comment(0)
K
0

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

Kimbrough answered 15/12, 2017 at 14:9 Comment(0)
B
0

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

Boaten answered 11/6, 2018 at 21:12 Comment(0)
W
0

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.

Web answered 1/11, 2018 at 16:15 Comment(0)
H
0

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.

Hemimorphite answered 3/4, 2019 at 8:57 Comment(0)
S
0

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.
Silicone answered 17/5, 2019 at 7:21 Comment(0)
C
0

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'
Clinkscales answered 17/12, 2019 at 22:55 Comment(0)
G
0

Xcode with Facebook and iOS working - Step By Step

After much frustration I got my Iphone game building just fine. Following a combination of Ixgee's solution, and other solutions.

Fixes - FBSDKCoreKit.h not found and other related issues

  • I'm using Unity and Facebook SDK v11
  1. Unity -> ExternalDependencyManager -> IOS Resolver Settings - make it build to a Xcode project and make sure all the checkboxes are checked.

  2. MacOS -> move project to Mac. In Terminal in the project directory do the ‘sudo chmod +x process_symbols.sh’

2.5 Make sure you have cocoa pods installed. In Terminal type ‘sudo gem install cocoapods’

  1. MacOS->Podfile - the pod file in your project should look like this for Facebook SDK 11

    source 'https://cdn.cocoapods.org/'
    platform :ios, '11.0'
    
    target 'UnityFramework' do
      pod 'FBSDKCoreKit', '~> 11.1.0', :modular_headers => true
      pod 'FBSDKCoreKit_Basics', '~> 11.1.0'
      pod 'FBSDKGamingServicesKit', '~> 11.1.0'
      pod 'FBSDKLoginKit', '~> 11.1.0'
      pod 'FBSDKShareKit', '~> 11.1.0'
    end
    target 'Unity-iPhone' do
    end
    use_frameworks! :linkage => :static
    use_frameworks!
  1. [Only needs to be done once. If your Mac processor uses an ARM processor (like the M1)]] Terminal -> Type ‘sudo arch -x86_64 gem install ffi’

Solution from - https://github.com/CocoaPods/CocoaPods/issues/10723 [super helpful!]

  1. [If your Mac processor uses an ARM processor (like the M1)] Terminal -> ‘arch -x86_64 pod install’

Or

[If your Mac processor uses an x86 processor (like an Intel)] Terminal -> ‘pod install’

  1. Once the Pod Install is successful, double click the newly created ‘Unity-iPhone.xcworkspace’ in your project directory to open the workspace in Xcode.

  2. Xcode->The folder option -> Unity-IPhone-> under Projects select ‘UnityFramework’-> select ‘Build Phases’ then drag the ‘> Headers’ above the ‘> Compile Sources’ -Full details here (https://forum.unity.com/threads/xcode-version-13-3-13e113-error-cycle-in-dependencies.1268720/)

  3. Xcode -> In the Unity-phone - Build Settings -> Set - ALWAYS EMBED SWIFT STANDARD LIBRARIES: YES In the UnityFramework - Build Settings -> Set - ALWAYS EMBED SWIFT STANDARD LIBRARIES: NO Source - Validation Error: Invalid Bundle. The bundle at ... contains disallowed file 'Frameworks'

  4. VOILA! It builds to your iPhone with Facebook SDK Dependencies good to go on iOS!!!

Gloriole answered 9/6, 2022 at 21:29 Comment(0)
B
-1

->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

Bolin answered 16/9, 2017 at 7:38 Comment(1)
No idea what you are trying to communicate here. Consider improving in case this is meant as answer!Distinctly
K
-2

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

xcode

Kazak answered 23/10, 2015 at 11:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.