FacebookSDK cannot log in, giving a blank white screen after login.

Added URL type, LSApplicationQueriesSchemes and other parameters.

Tried all possible solutions, failed to debug. Please help with this.

Not redirected to the application after authorization

+4
source share
3 answers

I solved this by performing BOTH of these functions, although the facebook developer site contains only one:

func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool {
    return FBSDKApplicationDelegate.sharedInstance().application(application, openURL: url, sourceApplication: sourceApplication, annotation: annotation)
}

func application(app: UIApplication, openURL url: NSURL, options: [String : AnyObject]) -> Bool {
        let shouldOpen :Bool = FBSDKApplicationDelegate.sharedInstance().application(
            app,
            openURL: url,
            sourceApplication: options["UIApplicationOpenURLOptionsSourceApplicationKey"] as! String,
            annotation: nil)


        return shouldOpen

}
+3
source

For those struggling with this for swift3 + ios10, make sure your appdelegate looks like this:

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

func applicationWillResignActive(_ application: UIApplication) {
    FBSDKAppEvents.activateApp()
}

func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
    return FBSDKApplicationDelegate.sharedInstance().application(application, open: url, sourceApplication: sourceApplication, annotation: annotation)
}

source

+2
source

If this is useful for everyone - I had a Facebook login button on a separate controller (in particular, in the user view, which presents a separate view controller). As soon as I placed the button inside the parent view controller, everything worked instantly.

+1
source

Source: https://habr.com/ru/post/1630001/


All Articles