Facebook iOS SDK 3.1 with XCode 4.2 linker errors
Asked Answered
M

5

19

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?

Microelectronics answered 26/9, 2012 at 9:7 Comment(0)
T
21

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.
Trinatrinal answered 26/9, 2012 at 14:21 Comment(6)
@marcog Did you add the Frameworks? project -> target -> build phases -> link binary with libraries -> + -> select AdSupport, Accounts and SocialMicroelectronics
I've just tried to add the frameworks manually to the project (I copied them from an up to date dev environment on a different machine). More errors. Anyway it would be a dirty hack leading to unpredictable behavior. I'm marking your answer as correct.Microelectronics
I got a similar problem with these frameworks in Xcode 4.5. I fixed it by removing them all, and making sure they weren't still referenced in the project files list, then readding them again.Trinatrinal
i tried removing and adding them but _ASIdentifierManager remains to casue problemsLillie
i can build the project on the device but not on the simulator what else could i have done wrongLillie
I have resolved _ASIdentifierManager issue by Adding Social and AdSupport frameworks into my project.It works for me both device & simulator. Note:Xcode 4.5 & FB sdk 3.1.Heaveho
C
9

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.

Counterproductive answered 4/10, 2012 at 15:14 Comment(0)
B
6

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.

Buzzard answered 2/10, 2012 at 22:14 Comment(1)
read the whole question please. There are no such frameworks (except for accounts) in xcode 4.2Microelectronics
L
0

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.

Latisha answered 28/9, 2012 at 0:30 Comment(0)
N
0

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.

Nasa answered 23/1, 2013 at 15:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.