How to make Xcode find file FacebookSDK.h?

百般思念 提交于 2019-11-27 12:01:11

First, you have to remove your FacebookSDK.framework from your Project. Then start over again with these 5 steps. DO NOT re-link the framework.

  1. Go to Build Phases in your Project Target.
  2. In Link Binary With Libraries, click the "+" button.
  3. Click on "Add Other..." button
  4. Browse your FacebookSDK folder. Generally in ~/Documents/FacebookSDK/
  5. Clik on (select) "facebookSDK.framework" and then OPEN.

That's it.

No need to remove anything.

In your project go to: "Build Settings”, then “Search Paths". Look for "Frameworks Search Paths". You probably have something fixed like this:

Frameworks Search Paths: /Users/john/Documents/exampleappxyz

Change it to:

Frameworks search paths: $(PROJECT_DIR)

Voila!.

I tried this but it did not work for me. I had to go into the Build Settings for the project and manually fix the FacebookSDK Framework Search Paths to find the FacebookSDK.

Abhishek Kumar

Ok guys, I think i got the answer. Follow the steps given below.

  1. Copy your framework into your project.
  2. Make sure it is under some directory. e.g. $(PROJECT_DIR)/project_name/Resources/Frameworks
  3. Click on the target.
  4. Goto Build Phases→Link binary with Libraries
  5. Add the custom framework by clicking "Add Other"
  6. Verify in the project navigator that the framework exists only once.
  7. Now goto Build Settings→Search Paths→Framework Search Path and make sure that it has the following two things.

    (a) $(inherited) (b) $(PROJECT_DIR)/project_name/Resources/Frameworks.

    Not to remind the framework exists inside the Frameworks folder

  8. Make sure that there is nothing in the library search path.
  9. Now click on the project (above target)→Build settings and repeat steps 7 and 8.
  10. Now clean the project and build the project.

Hope it works. Please remember not to keep any folder names with spaces. If you have kept them, make sure that you provide the correct escape characters.

How to remove facebook sdk links:

For those who like myself improperly added the facebook sdk. to remove the facebook SDK from your project,

check the link inside your frameworks folder, delete any facebook sdk link in there

go into Build Phases -> Link Binary With Libraries and delete any facebook sdk in there

Right click on the frameworks folder and select "show in finder" and delete any facebook sdk in there

Now follow "Fede Cugliandolo"'s steps and re add the facebook sdk

I got this problem today.

It turns out I need to have my Framework search path in all three places:

1) Project Build Settings
2) App Target Build Settings
3) UnitTests Target Build Settings

My search path is:

/Users/myusername/Documents/FacebookSDK

After ensure that, the error disappeared for me.

I use xcode 5 and when add sdk it not correct write self address in "project.pbxproj".

Instead local address for sdk it save global address.

I open "project.pbxproj" and finde the places of it and leave address only for sdk in project.

<project name>/src/external/facebook
<project name>/src/external/testflight

to edit the entry was as follows

/Users/<user Name>/myProjects/.../ios/<project name>/src/external/facebook

You have to change the property "Framework search path" in your build settings, and specify where the file FacebookSDK.framework is located (you can then use the SRCROOT variable to point to the root of your project directory, and thus, avoid using absolute paths ;)) e.g. :

$(SRCROOT)/SampleProject/src/Utils/Facebook/

this is normally done automatically by Xcode when you import a third part framework, but it messes sometimes, (eg: when your modify your project directory tree...)

Hope that helps...

besides adding the search path I also had to set the paths to recursive and remove "*.framework" from the "Sub Directories to Exclude" option for this to work.

This happens if you have imported the facebookSDK twice and after having deleting some files.

For example, I imported the facebookSDK in $project/framework but I deleted it for some reasons. Then I imported it via ~/Documents/FacebookSDK but Xcode kept the old folder and search in it by default.

I have to remove all references and files of the old import to resolve my issue.

I ended up checking my project directory, remove any old references to the framework file. Then, remove it from Build Phases/Search paths. Also remove the linked Framework. Restart Xcode, and do the process over again: drag Framework to Frameworks, don't copy in. Check the Build Phases/Search paths. include "#import ". Finally worked. Whew.

Follow the instruction At step 4 Configure your Xcode Project I think you missing something. Delete the Facebook.sdk in your project and try again.

Chico

I had the same issue when I updated XCode, but in my case I didn't want to make any manual changes to the project settings as I use CMake to create it. You can find the way I fixed it here: https://stackoverflow.com/a/25564152/525873

it is simple, you have to remove your FacebookSDK.framework from your Project.

Go to Build Phases in your Project Target. In Link Binary With Libraries, click the "+" button. Click on "Add Other..." button Browse your FacebookSDK folder. Generally in ~/mohit/Documents/FacebookSDK/ Clik on (select) "facebookSDK.framework" and then OPEN.

Now copy this Target settings > framework search path into Project setting > framework search path.

Tyrone

None of all answers above worked for me.

What finally did the trick for me was to change the structure of the plugin folder:

  1. Create folder: com.phonegap.plugins.facebookconnect/FacebookSDK

  2. Copy all content from: com.phonegap.plugins.facebookconnect/FacebookSDK.framework/Headers to com.phonegap.plugins.facebookconnect/FacebookSDK

  3. Copy com.phonegap.plugins.facebookconnect/Facebook.framework to com.phonegap.plugins.facebookconnect/FacebookSDK

And finally, change

#import <FacebookSDK/FacebookSDK.h>

to

#import "FacebookSDK/FacebookSDK.h"

The only solution I found was:

  1. Remove the phonegap plugin: ionic plugin rm phonegap-facebook-plugin

  2. Clone the next plugin git clone: https://github.com/jeduan/cordova-plugin-facebook4.git

  3. Add the plugin manually: cordova -d plugin add PATH/cordova-plugin-facebook4 --variable APP_ID="*****" --variable APP_NAME="*****"

Before this a tried to re add FacebookSDK.framework and installed the phonegap plugin facebook through a locally cloned, but the error continues.

Just follow these steps:

  1. Open Xcode's Build Settings tab in your project.
  2. Add ~/Documents/FacebookSDK to the project's Framework Search Paths setting.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!