Hesham Abd-Elmegid Hesham Abd-Elmegid - 1 year ago 307
iOS Question

Facebook SDK login never calls back my application on iOS 9

I've followed this guide to update my application to use Facebook SDK 4.6 to work properly when built with the iOS 9 SDK.

When I tap the login button now, a Safari view controller gets presented (shouldn't it redirect to the Facebook app?), but after accepting permission the Safari view controller is never dismissed. It loads a new blank page and sits there doing nothing. If I tap the Done button, the returned

is true.

Is it normal that the SDK is choosing the Safari view controller over the Facebook app? And why am I not getting callbacks after login is complete?

Answer Source

Turns out that on iOS 9 when UIApplicationDelegate's application:openURL:options: is implemented, application:openURL:sourceApplication:annotation: will not get called.

So what I had to do is call FBSDKApplicationDelegate's application:openURL:sourceApplication:annotation: from UIApplicationDelegate's application:openURL:options:

- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString*, id> *)options {
    return [[FBSDKApplicationDelegate sharedInstance] application:app
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download