具有FBSDKLoginBehaviorWeb的FBSDKLoginManager失败,并显示“未登录".错误 [英] FBSDKLoginManager with FBSDKLoginBehaviorWeb failing with "Not Logged In" error

查看:214
本文介绍了具有FBSDKLoginBehaviorWeb的FBSDKLoginManager失败,并显示“未登录".错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近在Facebook的服务器上,关于它们如何处理登录请求的方法一定已经发生了变化,因为它曾经运行得非常好,然后突然停止了.

Something must have changed recently on Facebook's servers regarding how they process login requests because this used to be working perfectly and suddenly stopped.

(我们之所以使用FBSDKLoginManager.loginBehavior = FBSDKLoginBehaviorWeb,是因为我们的应用程序是如何为多个品牌(一个代码库,许多应用程序)复制的,以及我们使用本机登录时遇到的问题.)

(We are using FBSDKLoginManager.loginBehavior = FBSDKLoginBehaviorWeb because of how our app is replicated for multiple brands (one codebase, many apps) and issues we ran into using the native login.)

无论如何,这就是我们现在尝试向用户显示登录Web视图时的情况( 之前,它甚至允许他们尝试登录):

Anyhow, this is what we see now when we try to present a login webview to the user (before it even lets them attempt to login):

(未登录:您尚未登录.请登录并重试.)

(Not Logged In: You are not logged in. Please login and try again.)

这是我们用来显示登录视图的代码:

This is the code we are using to present the login view:

NSString *const publish_actions = @"publish_actions";
FBSDKLoginManager* login = [FBSDKLoginManager new];
login.loginBehavior = FBSDKLoginBehaviorWeb;
[login logInWithPublishPermissions:@[publish_actions] handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) {
    [FBSDKAccessToken setCurrentAccessToken:result.token];
    // ...
}];

还请注意,此问题并非特定于iOS.我们的Android应用程序看到的是同一件事(直到最近,它仍然可以正常工作).

Also note that this problem is not specific to iOS. Our Android app is seeing the same thing (and again it used to work fine until just recently).

推荐答案

我遇到了同样的错误...似乎问题出在您的info.plist URL方案设置中:Facebook SDK:应用未注册为URL方案

I was having this same bug... seems as though the issue lies in your info.plist URL Scheme settings: Facebook SDK: app not registered as a URL Scheme

但是,添加这些内容会使应用程序将您带到实际的Facebook应用程序进行身份验证,而不是在您自己的应用程序中显示登录模式.

However, adding these leads to the app sending you off to the actual Facebook app for authentication, instead of showing the login modal in your own app.

**更新**

对不起,我讲得太早了……上述更改将有助于解决问题(或以您不希望的方式更改用户流),但是真正需要发生的事情(这是唯一的事情)是只需在Facebook Developer门户中的应用程序设置中添加"iOS平台"(或其他).无论如何,这就是为我做的. :)

Sorry, I spoke too soon... the above changes will help things out (or change the user flow in ways you don't want), but what really needed to happen (and this is the only thing), was just adding an "iOS Platform" (or other) to your app settings in the Facebook Developer portal. This is what did it for me anyways. :)

这篇关于具有FBSDKLoginBehaviorWeb的FBSDKLoginManager失败,并显示“未登录".错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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