Facebook 授权在 IOS 4.01 下不起作用
我使用官方 Facebook IOS API 中的 [facebook Authorize:permissions]
通过单点登录连接到 Facebook。
如果设备上未安装 Facebook 应用程序(Safari 授权),我的代码可以正常工作。它在运行 IOS5 并安装了 Facebook 应用程序(Facebook 应用程序授权)的设备上也可以正常工作。
但是,在运行 IOS 4.01 的设备上(我一直用它来测试我的应用程序),如果安装了 Facebook 应用程序,则 authorize
请求会启动 Facebook 应用程序,但当它返回时,我会在 < code>application: HandleOpenURL:
fb[MY_APP_ID]://authorize#error=unknown%5Ferror
这会导致 fbDidNotLogin:
被调用并且我的应用程序失败。
删除并重新安装 Facebook 应用程序和/或我自己的应用程序没有帮助。在我的应用程序之外注销 Facebook 也不会:在这种情况下,Facebook 应用程序会显示登录屏幕,但随后会返回相同的错误。
如果该设备上未安装 Facebook 应用程序并且使用 Safari 进行授权,则一切正常。
我在其他地方读到,此错误可能是由我的 Bundle ID 定义不正确引起的,但是 (1) 所有位置(我的 info.plist、Facebook 和 iTunes Connect)中的所有内容都定义正确,并且 (2) 在其他配置中确实可以正常工作。
是否有 IOS 4.01 不支持的东西导致了这种行为,或者我做错了什么? (此时我实际上并没有做太多事情,我只是发出一个授权请求并实现委托方法)。
I'm using [facebook authorize:permissions]
from the official Facebook IOS API to connect to Facebook using Single Sign On.
My code works fine if the Facebook App is not installed on the device (Safari authorization). It also works fine on a device running IOS5 with the Facebook App installed (Facebook App authorization).
However, on a device running IOS 4.01 (which I keep to test my Apps), if the Facebook App is installed, the authorize
request launches the Facebook App but when it returns I get the following reply in application: HandleOpenURL:
fb[MY_APP_ID]://authorize#error=unknown%5Ferror
Which causes fbDidNotLogin:
to be called and my App to fail.
Removing and re-installing the Facebook App and/or my own App does't help. Neither does logging out of Facebook outside my App: The Facebook App presents the Login screen in this case, but then it returns the same error.
If the Facebook App is not installed on that device and Safari is used for authorization, everything works fine.
I read elsewhere that this error may be caused by an incorrect definition of my Bundle ID, but (1) everything is defined correctly in all places (my info.plist, Facebook and iTunes Connect) and (2) things do work in other configurations.
Is there something that is not supported under IOS 4.01 which causes this behavior, or am I doing something wrong? (I'm not doing much actually at this point, I just place an Authorize request and implement the delegate methods).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要纠正此行为,您应该明确禁止 Facebook 应用程序进行 Facebook 授权。默认代码具有以下代码行 -
[selfauthorizeWithFBAppAuth:YES safariAuth:YES];
要禁止使用 facebook 应用程序授权并强制仅使用 safari 进行授权,请将其更改为 -
[selfauthorizeWithFBAppAuth:NO safariAuth:YES]。
To correct this behavior you should explicitly disallow facebook authorization with the facebook app. The default code has following line of code -
[self authorizeWithFBAppAuth:YES safariAuth:YES];
To disallow authorization with facebook app and force the authorization with safari only, change it to -
[self authorizeWithFBAppAuth:NO safariAuth:YES].