Etgar Etgar - 2 months ago 54
Swift Question

Facebook Authentication - Blank white screen during authentication - iOS 10 GM, Swift 3

Since Swift 3 - iOS 10, Xcode 8 GM SDK, I receive blank white screen at the end of the authentication with Facebook SDK.
It worked before. I have some warnings in the AppDelegate:

enter image description here

maybe it has something to do with it.

Edit:
I understood these functions are deprecated, and I tried changing these to the new functions, but the FBSDKApplicationDelegate still requests the older parameters...

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions)

}

func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
return FBSDKApplicationDelegate.sharedInstance().application(app, open: url, sourceApplication: <#T##String!#>, annotation: <#T##Any!#>)
}


As you see, the problem is now with the second function.

Answer

I understand these functions are deprecated in iOS 9, so that I used the others functions with their own API.

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
    return FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions)

}

func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
    return FBSDKApplicationDelegate.sharedInstance().application(app, open: url, sourceApplication: options[UIApplicationOpenURLOptionsKey
        .sourceApplication] as! String!, annotation: options[UIApplicationOpenURLOptionsKey.annotation])
}
Comments