Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make Xcode find file FacebookSDK.h?

It says "FacebookSDK/FacebookSDK.h file not found"

Yet I can jump-to-definition on the #import and it takes me to the file.

And once I added the #import it now knows what FBFriendPickerDelegate is and it now doesn't have an error on that line.

I have the facebookSDK.framework in my project and in the right folder. It's SDK 3.1. I tried adding search paths to /FacebookSDK and /FacebookSDK.framework and /FacebookSDK/Versions/A/Headers etc. I also tried #import "FacebookSDK.framework/Versions/A/Headers/FacebookSDK.h" and it still says it can't find it. I also tried clean and restarting. I have the latest version of Xcode.

// //  FacebookView.h //  #import <UIKit/UIKit.h> #import <FacebookSDK/FacebookSDK.h>  @interface FacebookView : UIViewController <FBFriendPickerDelegate> { } 
like image 723
Curtis Avatar asked Oct 11 '12 21:10

Curtis


2 Answers

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.

like image 115
Fede Cugliandolo Avatar answered Sep 28 '22 02:09

Fede Cugliandolo


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

like image 31
Hugo Avatar answered Sep 28 '22 01:09

Hugo