Facebook Login SDK in IOS 9

纵然是瞬间 提交于 2020-01-13 04:28:48

问题


I am using the facebook login SDK. It is working perfectly in IOS 7, 8 and 9. But if phone have the facebook app login verification is open the app in iOS 7 AND 8. BUT IOS 9 not open the facebook app. It is open the browser (Web page) and doing the verification. What is the reason? Anybody have any idea?

Edited

 FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];
    [FBSDKProfile enableUpdatesOnAccessTokenChange:YES];

    [login logInWithReadPermissions:@[@"public_profile", @"email"]
                 fromViewController:self
                            handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) {

                                if (error) {
                                    NSLog(@"Process error");
                                } else if (result.isCancelled) {
                                    NSLog(@"Cancelled");
                                } else {
                                    NSLog(@"Logged in");

                                    [[NSNotificationCenter defaultCenter] postNotificationName:FBSDKProfileDidChangeNotification object:nil];
                                }
                            }];

回答1:


This is by design and is using SFSafariViewController on iOS 9. As noted in the v4.6 changelog,

The SDK supports various iOS 9 features including Bitcode. In addition, the SDK dialogs such as Login, Like, Share Dialogs automatically determine the best UI based on the device, including SFSafariViewController instead of Safari

We know this may be confusing at first but we definitely have the same goal as our developers to make sure the users get the best experience on iOS 9 and have a good Login experience. On iOS 8, the login will still prefer an app switch to the Facebook app.




回答2:


loginButton.loginBehavior=FBSDKLoginBehaviorWeb;

try this it will open in the in app browser.




回答3:


Yes Puvanarajan have you set permission for iOS 9 facebook login ? if not then set facebook permisiion in info.plist as like below...

hope it will help you.




回答4:


You are using newest SDK, if you want to login through the facebook app that you should use older SDK.
I'm using SDK 4.4 build number 20150708.
Also 20150813 works well.
You can download here: https://developers.facebook.com/docs/ios/downloads Also add some lines to your Info.plist.



来源:https://stackoverflow.com/questions/32686934/facebook-login-sdk-in-ios-9

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!