简体   繁体   English

IOS 9中的Facebook登录SDK

[英]Facebook Login SDK in IOS 9

I am using the facebook login SDK. 我正在使用facebook登录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. 它在IOS 7,8和9中完美运行。但是如果手机有facebook app登录验证是在iOS 7和8中打开应用程序。但是IOS 9没有打开Facebook应用程序。 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];
                                }
                            }];

This is by design and is using SFSafariViewController on iOS 9. As noted in the v4.6 changelog , 这是设计使用并在iOS 9上使用SFSafariViewController。如v4.6更改日志中所述

The SDK supports various iOS 9 features including Bitcode. SDK支持各种iOS 9功能,包括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 此外,SDK对话框(如Login,Like,Share Dialogs)会根据设备自动确定最佳UI,包括SFSafariViewController而不是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. 我们知道这一开始可能会让人感到困惑,但我们确实与开发人员有着相同的目标,以确保用户在iOS 9上获得最佳体验并获得良好的登录体验。 On iOS 8, the login will still prefer an app switch to the Facebook app. 在iOS 8上,登录仍然会更喜欢将应用切换到Facebook应用。

loginButton.loginBehavior=FBSDKLoginBehaviorWeb;

试试这个它将在应用程序浏览器中打开。

Yes Puvanarajan have you set permission for iOS 9 facebook login ? 是Puvanarajan你有权设置iOS 9 facebook登录吗? if not then set facebook permisiion in info.plist as like below... 如果没有,那么在info.plist中设置facebook permisiion,如下所示...

在此输入图像描述

hope it will help you. 希望它会对你有所帮助。

You are using newest SDK, if you want to login through the facebook app that you should use older SDK. 您正在使用最新的SDK,如果您想通过Facebook应用程序登录,您应该使用较旧的SDK。
I'm using SDK 4.4 build number 20150708. 我正在使用SDK 4.4内部版本号20150708。
Also 20150813 works well. 20150813也运作良好。
You can download here: https://developers.facebook.com/docs/ios/downloads Also add some lines to your Info.plist. 您可以在此处下载: https//developers.facebook.com/docs/ios/downloads还可以在Info.plist中添加一些行。 在此输入图像描述 在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM