使用iOS SDK和本机Facebook应用程序无法向Facebook发送信息 [英] Can't auth to Facebook with iOS SDK and native Facebook application

查看:320
本文介绍了使用iOS SDK和本机Facebook应用程序无法向Facebook发送信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有什么和发生什么问题:


  1. 我有一个Facebook帐户与游戏应用程序(每天人们玩)

  2. 我还有一个Facebook测试应用程序,最近创建了默认设置。

  3. 我在我的iPod上有原生的Facebook应用程序

  4. 我正在开发使用Facebook iOS SDK的iOS应用程序。

流量无效: p>

如果我从第一个应用程序使用App ID / API Key,我打开我的应用程序并尝试登录。 Facebook SDK打开本机FB应用程序,并向我显示屏幕



我按OK,回到我的iOS,出现这样的错误,没有访问令牌:

 (NSError * )$ 0 = 0x001710f0错误Domain = com.facebook.sdk代码= 2操作无法完成(com.facebook.sdk错误2.)UserInfo = 0x16d4b0 {com.facebook.sdk:ErrorLoginFailedOriginalErrorCode = 210} 

有效流程:



如果我使用App从第二(测试)应用程序的ID / API密钥,我打开我的应用程序并尝试登录。 Facebook SDK打开本机FB应用程序,并向我显示屏幕



我按确定并返回到我的iOS有效的访问令牌。



应用程序的设置是一样的,我没有看到任何差异。如果我有原生的Facebook应用程序,就会出现此问题如果我没有,Facebook SDK打开浏览器,授权将成功与第一和第二个应用程序ID。



如果有人有这样的问题,请帮助。非常感谢。

解决方案

我解决了这个问题。



改变这里和那里后,我发现我的包ID不匹配。我已经在以下3个地方保持捆绑ID相同,它的工作原理是:


  1. 项目的捆绑标识符。

  2. 在您的FB a / c中,在iOS iOS应用程序下面命名为iOS软件包ID。

  3. AppDelegate.m

    中的通知字符串值 NSString * const FBSessionStateChangedNotification = @yourbundleid:FBSessionStateChangedNotification;



What I have and what're problems occurred:

  1. I've one Facebook account with game application (every day people's playing)
  2. I've one more Facebook account with test application, that created recently with default settings.
  3. I've native Facebook application on my iPod
  4. I'm developing iOS application which uses Facebook iOS SDK.

Invalid flow:

If I use App ID/API Key from first application, I open my application and trying to login. Facebook SDK opens native FB application and show me that screen

I press OK and go back to my iOS with such error and without access token:

(NSError *) $0 = 0x001710f0 Error Domain=com.facebook.sdk Code=2 "The operation couldn’t be completed. (com.facebook.sdk error 2.)" UserInfo=0x16d4b0 {com.facebook.sdk:ErrorLoginFailedOriginalErrorCode=210}

Valid flow:

If I use App ID/API Key from second (test) application, I open my application and trying to login. Facebook SDK opens native FB application and show me that screen

I press OK and go back to my iOS with valid access token.

Settings of applications are the same, I didn't see any differences. This problem occurred if I have native Facebook application. If I haven't it, Facebook SDK opens browser and authorization will be successful with first and second App ID.

If someone had such problem, please help. Thanks a lot.

解决方案

I solved the issue.

Actually after changing here and there I found my bundle id was not matching. I have kept the bundle id same in the following 3 places and it worked:

  1. The bundle identifier of your project.
  2. In your FB a/c the filed named "iOS Bundle ID:" under head Native iOS App.
  3. The notification string value in your AppDelegate.m

    NSString *const FBSessionStateChangedNotification = @"yourbundleid:FBSessionStateChangedNotification";

这篇关于使用iOS SDK和本机Facebook应用程序无法向Facebook发送信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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