简体   繁体   中英

Facebook SDK Integration - Returns

I can't finish FB SDK integration in to my project, because I can't add these lines of code from their Quick Start Guide:

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

because I already have a return there:

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

As I know there couldn't be 2 returns . What should I do? How can I setup FB SDK then?

You want this:

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

Because you pass your application down into the FB SDK which has it's own -didFinishLaunchignWithOptions method-- which returns the BOOL that bubbles back up to your main app delegate, which in turn returns that BOOL again

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM