5

我是 iOS 中 Facebook SDK 的新手。为什么我在构建项目时收到此错误...

我刚刚使用 Facebook SDK 的 ios 教程中的基本步骤创建了一个新项目。

  • 下载 Facebook SDK(我用的是 3.1.1)
  • Xcode(我使用 4.5.2)
  • 添加“-lsqlite3.0 Other Linker FlagsBuild Setting
  • 添加 FacebookSDK.framework
  • 添加 FacebookSDKResources.bundle
  • 添加 FBUserSettingsViewResources.bundle

我尝试构建,一切都好..所以我继续在 AppDelegate 上编写基本实现

- (BOOL)application:(UIApplication *)application
            openURL:(NSURL *)url
  sourceApplication:(NSString *)sourceApplication
         annotation:(id)annotation {
    return [FBSession.activeSession handleOpenURL:url];
}

#import <FacebookSDK/FacebookSDK.h>

当我尝试构建时,出现错误...这是日志

Undefined symbols for architecture armv7:
  "_OBJC_CLASS_$_ACAccountStore", referenced from:
      objc-class-ref in FacebookSDK(FBSession.o)
  "_ACFacebookAudienceFriends", referenced from:
      -[FBSession authorizeUsingSystemAccountStore:accountType:permissions:defaultAudience:isReauthorize:] in FacebookSDK(FBSession.o)
  "_ACFacebookAppIdKey", referenced from:
      -[FBSession authorizeUsingSystemAccountStore:accountType:permissions:defaultAudience:isReauthorize:] in FacebookSDK(FBSession.o)
  "_ACAccountTypeIdentifierFacebook", referenced from:
      +[FBSession renewSystemAuthorization] 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)
  "_ACFacebookAudienceEveryone", referenced from:
      -[FBSession authorizeUsingSystemAccountStore:accountType:permissions:defaultAudience:isReauthorize:] in FacebookSDK(FBSession.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我发现这很奇怪,因为我使用与示例相同的 SDK 和相同的设置Scrumptious,并且示例运行良好.. 同时我得到了这个错误......

任何想法?

4

1 回答 1

23

我得到了答案... Facebook IOS SDK 3.1 需要更多的框架来使用.. 它需要IOS6上可用的“Accounts”、“AdSupport”和“Social”框架。因为Facebook SDK 3.1是基于IOS6..

注意:如果您希望您的应用程序也为旧版本的操作系统构建,您应该为 iOS6 特定框架使用OPTIONAL标志。它看起来像这样。

在此处输入图像描述

于 2012-11-29T08:52:38.720 回答