borisdiakur
borisdiakur

Reputation: 12082

Facebook iOS SDK 3.1 with XCode 4.2 linker errors

I've just updated the Facebook iOS SDK in my project from 3.0 to 3.1. The project does not compile anymore. Instead I get the following linker errors:

Undefined symbols for architecture i386:
  "_ACFacebookAppIdKey", referenced from:
      -[FBSession authorizeUsingSystemAccountStore:accountType:permissions:defaultAudience:isReauthorize:] in FacebookSDK(FBSession.o)
  "_ACFacebookAudienceEveryone", referenced from:
      -[FBSession authorizeUsingSystemAccountStore:accountType:permissions:defaultAudience:isReauthorize:] in FacebookSDK(FBSession.o)
  "_ACFacebookAudienceFriends", referenced from:
      -[FBSession authorizeUsingSystemAccountStore:accountType:permissions:defaultAudience:isReauthorize:] in FacebookSDK(FBSession.o)
  "_ACFacebookAudienceKey", referenced from:
      -[FBSession authorizeUsingSystemAccountStore:accountType:permissions:defaultAudience:isReauthorize:] in FacebookSDK(FBSession.o)
  "_ACFacebookAudienceOnlyMe", referenced from:
      -[FBSession authorizeUsingSystemAccountStore:accountType:permissions:defaultAudience:isReauthorize:] in FacebookSDK(FBSession.o)
  "_ACFacebookPermissionsKey", referenced from:
      -[FBSession authorizeUsingSystemAccountStore:accountType:permissions:defaultAudience:isReauthorize:] in FacebookSDK(FBSession.o)
  "_OBJC_CLASS_$_ASIdentifierManager", referenced from:
      objc-class-ref in FacebookSDK(FBSettings.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

The Facebook docs clearly say:

The SDK relies on three other frameworks (AdSupport, Accounts and Social) to use the Facebook features built into iOS6.

Those frameworks do not exist in Xcode 4.2 . Is there any workaround, i.e. can I download (where?) and add the frameworks manually to my project and will that suffice to get rid of the compile errors or do I have to upgrade to Xcode 4.5?

Upvotes: 19

Views: 14767

Answers (5)

prodeveloper
prodeveloper

Reputation: 950

The following steps may be helpful to resolve this issue

  1. Download Facebook iOS SDK 3.0 from links present in the URL http://developers.facebook.com/ios/features/whats-new-ios-sdk-3/
  2. Add the FacebookSDK framework from Mac Documents directory
  3. Add sqlite3 to project

Then, I've tried the code in http://developers.facebook.com/docs/howtos/login-with-facebook-using-ios-sdk/ with the following changes (as it is for Facebook iOS SDK 3.1)

  1. Replace openActiveSessionWithReadPermissions with openActiveSessionWithPermissions
  2. Replace [FBSession.activeSession handleDidBecomeActive]; with [FBSession activeSession];

This worked for me. Try it once.

Thanks, prodeveloper.

Upvotes: 0

GeneCode
GeneCode

Reputation: 7588

To make things clear:

For XCode 4.5:

If you use FB SDK3.0, you only need to add Accounts and FacebookSDK frameworks.

If you use FB SDK3.1, you need to add Accounts, FacebookSDK, Social, and AdSupport frameworks.

If you use FB SDK3.2++, check by yourself what other frameworks you may or may not need. ;)

Hope that sums it up nicely for everyone.

Upvotes: 9

Burak
Burak

Reputation: 5764

The SDK relies on three other frameworks (AdSupport, Accounts and Social).

To add these, go to the 'Linked Frameworks and Libraries' section of the target's Summary pane, and add them.

Upvotes: 6

Shireesh Asthana
Shireesh Asthana

Reputation: 724

Sobri is right. Either upgrade to Xcode 4.5 or use SDK 3.0 or If you want to use 3.1 then download the source from github, modify the build file(basically remove the references to frameworks provided by iOS 6.0 ) and rebuild the SDK. That ways you can use the SDK 3.1 as well as run it on older XCode versions.

Upvotes: 0

sobri
sobri

Reputation: 1685

Those frameworks are part of iOS 6 (well, except for Accounts, which is from iOS 5). You won't be able to use them without upgrading to Xcode 4.5, and consequently, iOS 6 SDK.

You can still set your deployment target down to iOS 4.3, if that's your concern.

I think your options are:

  1. Upgrade to Xcode 4.5, or
  2. Use Facebook SDK 3.0.

Upvotes: 21

Related Questions