新的 SDK 实际上需要 6 个。
不知道是什么导致了错误,但为了消除构建问题,我只是清理了构建文件夹,从项目中删除了派生数据,并删除并重新添加了 facebook 库。
然后为了防止这种情况在 iOS 6 之前的情况下爆炸,我将它添加到我的应用程序中:
+ (BOOL)isSocialFrameworkAvailable
{
static BOOL available = NO;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
available = NSClassFromString(@"SLComposeViewController") != nil;
});
return available;
}
- (BOOL)application: (UIApplication *) application didFinishLaunchingWithOptions: (NSDictionary *) launchOptions
{
// [...]
if ([[self class] isSocialFrameworkAvailable]) {
[FBSettings setLoggingBehavior:[NSSet setWithObjects:
FBLoggingBehaviorFBRequests,
FBLoggingBehaviorFBURLConnections,
FBLoggingBehaviorAccessTokens,
FBLoggingBehaviorPerformanceCharacteristics,
FBLoggingBehaviorSessionStateTransitions,
nil]];
NSDate *facebookIdPublishedDate = [[NSUserDefaults standardUserDefaults] objectForKey:@"facebookIdPublishedDate"];
if (!facebookIdPublishedDate) {
[[NSUserDefaults standardUserDefaults] setObject:[NSDate date] forKey:@"facebookIdPublishedDate"];
[FBSettings publishInstall:@"XXXXXXXXXXXXXXXX"];
}
}
// [...]
}