简体   繁体   English

iOS / Swift / FBSDKLoginKit:使用FBSDKLoginManager()登录。logInWithReadPermissions通过获取result.isCancelled为true而失败。

[英]iOS/Swift/FBSDKLoginKit: Login using FBSDKLoginManager().logInWithReadPermissions gets failed by getting result.isCancelled to true

I am working on App in which I have added FBSDKLoginKit to allow user login using Facebook. 我正在开发其中添加了FBSDKLoginKit的应用程序,以允许用户使用Facebook登录。 After entering facebook user id and password, I see below page. 输入Facebook用户名和密码后,我将看到以下页面。 在此处输入图片说明

Now, I press ok button, I am seeing blank page. 现在,我按确定按钮,我看到空白页。

在此处输入图片说明

As expected, I should not see blank page. 不出所料,我应该看不到空白页。 So I press Done button at upper left corner, program call function handleImplicitCancelOfLogIn from SDK and I see login's not successful and the its routed to app's login home page. 因此,我按了左上角的“完成”按钮,从SDK调用了程序调用函数handleImplicitCancelOfLogIn,我看到登录不成功并将其路由到应用程序的登录主页。

I don't see any error while debugging, but when I press Done button I see flag result.isCancelled is set to true (because done button tap calls function handleImplicitCancelOfLogIn) 我在调试时没有看到任何错误,但是当我按“完成”按钮时,我看到标志result.isCancelled设置为true(因为完成按钮点击会调用handleImplicitCancelOfLogIn函数)

   FBSDKLoginManager().logInWithReadPermissions(["public_profile"], fromViewController: hostViewController) { (result, error) in
        if error != nil || result.isCancelled {
            completion(error: error ?? NSError(domain: "Facebook Login Failed", code: -1, userInfo: nil))
        }

In above call, I see error equal to nil but result.isCancelled is set to true. 在上面的调用中,我看到错误等于nil,但result.isCancelled设置为true。

I checked other thread listed below similar to this, and I am sure that all calls related to Facebook are their and working fine. 我检查了下面列出的与此类似的其他线程,并且我确定所有与Facebook有关的调用都可以正常工作。

  1. Facebook FBSDKLoginManager/logInWithReadPermissions Swift Example not using Parse Facebook FBSDKLoginManager / logInWithReadPermissions Swift示例不使用Parse
  2. Facebook login fails (always isCancelled) after upgrading to SDK 4.1 升级到SDK 4.1后,Facebook登录失败(始终为isCancelled)

This is happening for iOS 8 and 9 as well and this was working when developed first time. iOS 8和9也会发生这种情况,并且在首次开发时就可以使用。

Current API version “4.12.0", Xcode version - Version 7.3 (7D175), iOS 8.0 and 9.0 If I use iOS 8, I see weird response on Safari webpage. 当前的API版本“ 4.12.0”,Xcode版本-版本7.3(7D175),iOS 8.0和9.0如果使用iOS 8,我在Safari网页上看到奇怪的响应。

Any clue/hint will be greatly appreciated. 任何线索/提示将不胜感激。 Let me know if you need to know anything further. 让我知道您是否需要进一步了解。

You need to implement the callback method in AppDelegate. 您需要在AppDelegate中实现回调方法。 UIApplicationDelegate 's application:openURL:options: for iOS 9.0 and above. UIApplicationDelegateapplication:openURL:options:适用于iOS 9.0及更高版本。 application:openURL:sourceApplication:annotation: for iOS 8.0. application:openURL:sourceApplication:annotation:适用于iOS 8.0。

The question is already answered here: Facebook SDK login never calls back my application on iOS 9 这个问题已经在这里得到解答: Facebook SDK登录从不回叫我在iOS 9上的应用程序

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

相关问题 Facebook FBSDKLoginManager / logInWithReadPermissions Swift示例不使用Parse - Facebook FBSDKLoginManager/logInWithReadPermissions Swift Example not using Parse FBSDKLoginManager loginWithReadPermissions - FBSDKLoginManager loginWithReadPermissions FBSDKLoginManager logInWithReadPermissions? - FBSDKLoginManager logInWithReadPermissions? FBSDKLoginManager.loginWithReadPermissions不在iOS上调用处理程序 - FBSDKLoginManager.loginWithReadPermissions not calling handler on iOS 使用Facebook登录而不是FBSDKLoginKit AppDelegate.swift代码的iOS Swift - IOS Swift using Facebook Login instead of FBSDKLoginKit AppDelegate.swift code 使用Facebook登录,并以IsCancelled身份面向FBSDKLoginManagerLoginResult即时在iOS 11中始终为true - Login Using Facebook and im facing FBSDKLoginManagerLoginResult as IsCancelled true always in IOS 11 iOS的Firebase Facebook登录(Swift)-使用未解析的标识符'FBSDKLoginManager' - Firebase facebook login for ios (swift) - Use of unresolved indentifier 'FBSDKLoginManager' 使用FBSDKLoginManager for IOS的​​安全问题 - Security concerns for using FBSDKLoginManager for IOS 在iOS上使用FBSDKLoginKit使用自定义登录按钮时,如何注销Facebook? - How to log out of Facebook when using a custom login button, on iOS using FBSDKLoginKit? FBSDKLoginManager 未在本机 ios 应用程序中打开登录对话框 - FBSDKLoginManager not open login Dialog in native ios apps
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM