简体   繁体   中英

Login with facebook app in ios app shows option in safari “Login with Facebook app” and its not working in ios 10.1

In my app, i am using login with a Facebook option. Where I set Facebook SDK behavior"FBSDKLoginBehaviorNative"

When I try to login with facebook its show me two option "Login with the facebook app" or "Login with phone or email" in ios 10.1. In ios 9 its direct shows me login page where email/password I have to enter

But in ios 10.1 it shows above two option and when I click on "Login with the Facebook app", it shows dialog "open in facebook" and on click of "open" button it authorizes to my app, Now it has to come back to my app but it stay in Safari view controller where two options are given of login and never come back to my app

在此输入图像描述

In my application its happening because of salesforce sdk security option which cancel facebook login when app went to facebook app for authorization. I disable snapshotview and facebook login works fine

[SalesforceSDKManager sharedManager].useSnapshotView = NO;

So this is not facebook issue but its happening due to third party sdk.

As of iOS 11, my in-app Facebook login was also going to the Facebook.com page instead of the device app. Based on the fix below, it seems that FB just changed the behavior default. Setting the button to system fixed it for me.

self.fbloginButton.loginBehavior = FBSDKLoginBehaviorSystemAccount;

That switched the app back to the fast app switching.

     func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {

     /*

      for facebook login

    */ 

            if #available(iOS 9.0 , *){
                return ApplicationDelegate.shared.application(app, open: url, sourceApplication: options[UIApplication.OpenURLOptionsKey.sourceApplication] as? String, annotation: options[UIApplication.OpenURLOptionsKey.annotation])

            }

      /*

       for google signin

     */
            return GIDSignIn.sharedInstance().handle(url as URL?,
                                                     sourceApplication: options[UIApplication.OpenURLOptionsKey.sourceApplication] as? String,
                                                     annotation: options[UIApplication.OpenURLOptionsKey.annotation])
        }

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