Curtis
Curtis

Reputation: 2535

Facebook iOS SDK sample code doesn't compile

I downloaded the code from https://github.com/facebook/facebook-ios-sdk

But none of the sample projects compile in Xcode. I have read the readme.txt and it doesn't help.

The error is: 'FacebookSDK/FacebookSDK.h' file not found

There is no folder called FacebookSDK, it's actually called src. When I change the code to say src the new error is: ld: framework not found FacebookSDK clang: error: linker command failed with exit code 1 (use -v to see invocation)

Can anyone download the code and get the samples to work?

Upvotes: 1

Views: 5756

Answers (3)

myclues
myclues

Reputation: 123

If you install the package to another location besides ~/Documents, you need to change the Framework Search Path for the sample projects.

When you open the project up in XCode, click the project info (e.g. blue "HelloFacebookSample" in the file browser.

  1. Go to the Build Settings tab.
  2. Under the "Search Paths" section, find "Framework Search Paths".
  3. Doubleclick the value and you'll see an entry that is like:

    $(SRCROOT/../../../../Documents/FacebookSDK
    
  4. Double click that value and change it to point to the destination folder where you placed the SDK.

In my case, I installed the SDK to /Dropbox/SDKs/FacebookSDK so I changed the value to

$(SRCROOT/../../../../SDKs/FacebookSDK

(the 4 ../ are because it's relative to the HelloFacebookSample project)

Upvotes: 1

ErikaSage
ErikaSage

Reputation: 46

I wrestled with this same problem for a while before discovering that there is a not-so-obvious file that is supposed to be downloaded and installed (versus just getting the ZIP file and its contents). The file is called FacebookSDK-3.0.pkg and I found it at:

http://www.google.com/url?sa=t&rct=j&q=facebooksdk-3.0.pkg&source=web&cd=1&ved=0CEgQFjAA&url=https%3A%2F%2Fgithub.com%2Fdownloads%2Ffacebook%2Ffacebook-ios-sdk%2FFacebookSDK-3.0.pkg&ei=Mg8kULzOLofgiALg14DwDQ&usg=AFQjCNF0i0Vkq_cPsOvfrs5nb_IOUR6XhA&sig2=kERJcdvR7UgAB6mr-RUi6w

(first link provided when searching for the filename) I installed it and the samples work fine now.

Upvotes: 3

Related Questions