Facebook SDK 3.1.1& iOS 6.1登录错误 [英] Facebook SDK 3.1.1 & iOS 6.1 Login error

查看:173
本文介绍了Facebook SDK 3.1.1& iOS 6.1登录错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这似乎是一个重复的问题,但我已经查看了与此相关的堆栈溢出的每一个问题,我仍然收到以下错误:

I know this is going to seem like a duplicate question, but I've looked at every single question on stack overflow relating to this and I'm still getting the following error:

Error Domain=com.facebook.sdk Code=2 "The operation couldn’t be completed. 
(com.facebook.sdk error 2.)" UserInfo=0x1ecbf8e0       
{com.facebook.sdk:ErrorLoginFailedReason=com.facebook.sdk:ErrorLoginFailedReason}

这是NSError的整个NSLog ..

That's the entire NSLog of the NSError..

我已按照教程对信件进行身份验证;

I have followed the tutorials for authentication to the letter;


  • 在developers.facebook.com上我已经将我的应用程序设置为原生iOS应用程序,并输入我的包ID

  • 在我的info.plist中我已经包含URL类型>项目0> URL方案>项目0> fb123456和FacebookAppID = 123456,密钥。

我正在尝试使用身份验证以下代码;

I am attempting to authenticate using the following code;

[FBSession openActiveSessionWithReadPermissions:permissions
                               allowLoginUI:YES
                          completionHandler:
 ^(FBSession *session,
   FBSessionState state, NSError *error) {
     [self sessionStateChanged:session state:state error:error];
 }];

权限设置为nil。

我在我的app委托中也有以下设置

I also have the following set in my app delegate

- (void)applicationDidBecomeActive:(UIApplication *)application
{
[FBSession.activeSession handleDidBecomeActive];
}

- (void)applicationWillTerminate:(UIApplication *)application
{
[FBSession.activeSession close];
}

- (BOOL)application:(UIApplication *)application
        openURL:(NSURL *)url
  sourceApplication:(NSString *)sourceApplication
     annotation:(id)annotation {
return [FBSession.activeSession handleOpenURL:url];
}

- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url
{
return [FBSession.activeSession handleOpenURL:url];
}

我注意到的一件事是错误消息在我的屏幕附近瞬间到达我释放按钮,我把手机放到飞机模式,速度是一样的,我认为命令甚至没有离开手机,并开始到Facebook服务器..我肯定有网络连接,因为我访问在Facebook通话之前的谷歌api。

One thing I have noted is that the error message hits my screen near instantly after I release the button, I put the phone into airplane mode and the speed was the same, I am thinking that the command is not even leaving the phone and going to the facebook server to begin with.. I definitely have network connection as I access a google api moments before the facebook call.

编辑:

如果我使用下面弃用的方法

If I use the deprecated method below

[FBSession openActiveSessionWithPermissions:nil allowLoginUI:YES completionHandler:
 ^(FBSession *session,
   FBSessionState state, NSError *error) {
     [self sessionStateChanged:session state:state error:error];
 }];

我可以通过Facebook验证。

I am able to authenticate with facebook.

返回的会话是

<FBSession: 0x20038450, state: FBSessionStateOpen, loginHandler: 0x2006ba90, appID: 3895930xxxxxxxx, urlSchemeSuffix: , tokenCachingStrategy:<FBSessionTokenCachingStrategy: 0x1ed4ce30>, expirationDate: 2013-04-08 16:25:19 +0000, refreshDate: 2013-02-07 16:25:19 +0000, attemptedRefreshDate: 0001-12-30 00:00:00 +0000, permissions:(
)>

与使用更新的3.1.1方法失败尝试的此会话相比

compared with this session from the failed attempt with the updated 3.1.1 methods

<FBSession: 0x1e8970b0, state: FBSessionStateClosedLoginFailed, loginHandler: 0x0, appID: 3895930xxxxxxxx, urlSchemeSuffix: , tokenCachingStrategy:<FBSessionTokenCachingStrategy: 0x1d5853b0>, expirationDate: (null), refreshDate: (null), attemptedRefreshDate: 0001-12-30 00:00:00 +0000, permissions:(
)>

我假设成功登录后会创建缺少的loginHandler对象。

I'm assuming the missing loginHandler object gets created upon successful login.

虽然这允许我使用我的登录令牌继续开发我的应用程序的其余部分,但我无法接受现场发送我的应用程序。有谁知道为什么会发生这种情况/可能导致这种情况发生?

While this allows me to continue developing the rest of my app with my logged in token, this is not acceptable for me to send my app live. Does anyone know why this is happening/what might be causing this?

推荐答案

我在2个实例上遇到了同样的错误。

I have got the same error on 2 instances.


  1. 当您的iPhone中的设置 - > Facebook - > YourAppName下的开关没有打开时,为了让您的应用可以使用Facebook帐户。在这种情况下,我正在显示一条警告,要求用户打开该应用程序的开关。

  1. When the switch is not turned on in your iPhone under Settings -> Facebook -> YourAppName in order to allow your app to use the facebook account. In this case I am displaying an alert asking the user to turn the switch on for the app.

当您的应用程序的软件包标识符与软件包不匹配时您在应用的Facebook应用设置页面上指定的标识符。

When the bundle identifier of your app does not match the bundle identifier that you specified on Facebook App Settings page for your app.

因为即使没有互联网连接也会出现错误我认为应该是案例1.

Since the error occurs for you even without internet connection I think it should be case 1.

这篇关于Facebook SDK 3.1.1&amp; iOS 6.1登录错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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