Facebook登录总是回来取消。 (iOS Swift) [英] Facebook login always comes back as cancelled. (iOS Swift)

查看:286
本文介绍了Facebook登录总是回来取消。 (iOS Swift)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用4.0版本的SDK实现Facebook登录,这也发生在3. +版本。当我调用 logInWithReadPermissions (4.0版本)或 openActiveSessionWithReadPermissions (3. +版本)时。使用 isCancelled (4.0版本)和 ClosedFailedLogin (3. +版本)之前立即调用闭包/块,然后用户可以进行选择(取消 ok )。我认为这可能是我的plist设置中的URL计划的一个问题,但我已经检查了它,一切似乎是对的。只是想知道有没有人可能有任何想法来解决这个问题。我的Bundle ID是对的,单点登录,本地应用启用,在Facebook开发控制台。请参阅下面的示例代码和配置(4.0版本)。

I'm currently trying implement Facebook login using the 4.0 version of the SDK, this also happens with the 3.+ version. When I call logInWithReadPermissions (4.0 version) or openActiveSessionWithReadPermissions (3.+ version). The closure/block is called immediately with isCancelled (4.0 version) and ClosedFailedLogin (3.+ version) before the user can make a selection (cancel or ok). I thought it may be a problem with the URL Scheme in my plist settings but I've checked it over and over and everything seems to be right. Just wondering if anyone may have any ideas on solving this problem. My Bundle ID is right, single signin is on, native app is enabled, in the Facebook dev console. See some sample code and configurations below (4.0 version).

登录呼叫:

AppDelegate:

Plist:

推荐答案

我有一些问题,但我发现了一个解决方法。您可以设置登录管理器的登录行为,以便在手机上使用Facebook详细信息。默认行为是FBSDKLoginBehaviorSystemNative,并且首先尝试使用Facebook应用程序,然后如果它不在那里,它将使用Web模式。

I had the some problem but I found a workaround. You can set the login behaviour of the Login Manager to use the Facebook details on the phone. The default behaviour is FBSDKLoginBehaviorSystemNative and that tries to use the Facebook app first and then if its not there, it uses a web modal.

而不是这样做和传递围绕不似乎工作的网址,您可以将登录行为设置为 FBSDKLoginBehaviorSystemAccount

Instead of doing it that way and passing around urls that don't seem to work you can set the login behaviour as FBSDKLoginBehaviorSystemAccount.

长篇小说,尝试:

let fbLoginManager = FBSDLoginManager();
fbLoginManager.loginBehavior = FBSDKLoginBehaviorSystemAccount;
// call login method of choice here

这篇关于Facebook登录总是回来取消。 (iOS Swift)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆