Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 523
borisdiakur Avatar asked Sep 26 '12 09:09

borisdiakur


People also ask

How does the Facebook SDK for iOS work with idfas?

The Facebook SDK for iOS only accesses IDFAs in the following scenarios: 1) if your app serves ads within the app through Facebook’s Audience Network, or 2) if your app logs app installs or other mobile App Events in order to attribute those events to your ad campaigns.

How do I update the Facebook SDK for my App?

If you use SPM or CocoaPods to integrate the Facebook SDK, see the Upgrade Guide for information on how to update your app. You can also download the latest version of the Facebook iOS SDK, integrate it into your app, and recompile.

How do I display errors in the Facebook SDK?

Each framework in the SDK defines the errors in the FBSDK*Constants.h file. The Facebook SDK populates keys defined in FBSDKConstants.h in FBSDKCoreKit.framework in the userInfo dictionary of NSErrors where possible. You should display only the localized messages as errors.

Why are my classes not loading in Xcode Interface Builder?

Classes that are used from the Xcode interface builder are also not loaded automatically, for example when you add a FBSDKLoginButton to your interface by drawing a view in your .xib file and then setting it as FBSDKLoginButton from the interface builder UI.


2 Answers

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.
like image 134
sobri Avatar answered Sep 19 '22 14:09

sobri


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.

like image 24
GeneCode Avatar answered Sep 17 '22 14:09

GeneCode