Facebook SDK 集成 - Returns

Facebook SDK Integration - Returns

我无法将 FB SDK 集成到我的项目中,因为我无法从他们的快速入门指南中添加这些代码行:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  return [[FBSDKApplicationDelegate sharedInstance] application:application
                                    didFinishLaunchingWithOptions:launchOptions];
}

因为我那里已经有一个 return:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [self LoginToGameCenter_iOS_7_forth_way];
    return YES;
}

据我所知不可能有 2 returns。我应该怎么办?那么我该如何设置 FB SDK?

你想要这个:

- (BOOL)application:(UIApplication *)application
        didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [self LoginToGameCenter_iOS_7_forth_way];
    return [[FBSDKApplicationDelegate sharedInstance] application:application
                                    didFinishLaunchingWithOptions:launchOptions];
}

因为您将您的应用程序向下传递到 FB SDK 中,它有自己的 -didFinishLaunchignWithOptions 方法——returns BOOL 冒泡备份到您的主应用程序委托,它反过来 returns 那 BOOL