-->

Facebook Login does not return to App with Xcode 7

2019-04-08 20:54发布

问题:

I have implemented this method for Facebook Login in the App Delegate using Xcode 7 and it works perfectly:

- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString*, id> *)options {

return [[FBSDKApplicationDelegate sharedInstance] application:app
                                                      openURL:url
                                            sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]
                                                   annotation:options[UIApplicationOpenURLOptionsAnnotationKey]];
}

However, since I need to use Xcode 6 to submit my app to the App Store, this method does not exists and it give me errors.

If I comment the above method, and leave only the following:

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {

return [[FBSDKApplicationDelegate sharedInstance] application:application
                                                      openURL:url
                                            sourceApplication:sourceApplication
                                                   annotation:annotation
        ];


}

it will not work, that is, when the user tries to Login, it does not return to the Application.

Is there an easy fix for this? Thanks!

BTW, I have followed diligently all steps in : https://developers.facebook.com/docs/ios/getting-started

回答1:

Seems there's no way to get the previous behavior using newests FB SDKs in iOS9. You can use a old SDK to do that. Here's a response from the facebook to that question: