facebook-ios-SDK问题 [英] facebook-ios-SDK question

查看:102
本文介绍了facebook-ios-SDK问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始使用facebook-ios-SDK。我试图运行示例应用程序来了解框架的工作原理。我以前从未使用FB Graph API,或者确实使用过FB连接。当APP运行时,我可以点击登录按钮,Safari将启动使用我的帐户授权FB应用程序。一旦我授权它,我认为页面尝试重定向并切换回示例应用程序,但失败,safari显示无法打开页面。



我在哪里出错?

解决方案

你可能需要设置授权回调。
这是从SDK的自述文件:


将您的应用程序绑定到与您的
Facebook应用程序ID相对应的URL方案。您必须绑定的URL方案是
格式fb [appId]://,其中[appId]是您的Facebook应用程序
ID。没有这个,您的应用程序将无法处理
授权回调。修改您的应用程序的 .plist 文件为
如下:




  • 根密钥(信息属性列表)添加一个新行,
    命名关键字URL类型。

  • 在刚刚添加的URL类型键下,应该会看到一个名为项目0。如果没有,请添加一个带有项目0的新行。

  • 在项目0键下,添加一个新行并命名关键字URL方案。

  • 在URL方案键下你刚刚添加,你应该看到一个名为项目0的键。如果没有,请添加一个带有项目0的新行。

  • 将项目0的值设置为fb [appId],其中[appId]是您的Facebook应用程序ID。确保此值中的任何位置没有空格。例如,如果您的应用程序的ID为1234,则该值应为fb1234。



I've just started using the facebook-ios-SDK. I'm trying to run the sample app to get a feel for how the framework works. I have never used the FB Graph API before, or indeed used FB connect. When the APP runs I can tap the Login button, and Safari launches to authorise the FB app with my account. Once I have authorised it I think the page tries to redirect and switch back to the sample app but fails, with safari showing "Cannot Open Page".

Where am I going wrong?

解决方案

You probably need to setup an authorization callback. This is from SDK's readme file:

Bind your application to a URL scheme corresponding to your Facebook application ID. The URL scheme you must bind to is of the format "fb[appId]://", where [appId] is your Facebook application ID. Without this, your application won't be able to handle authorization callbacks. Modify your application's .plist file as follows:

  • Under the root key ("Information Property List") add a new row and name the key "URL types".
  • Under the "URL types" key that you just added, you should see a key named "Item 0". If not, add a new row with key "Item 0".
  • Under the "Item 0" key, add a new row and name the key "URL Schemes".
  • Under the "URL Schemes" key that you just added, you should see a key named "Item 0". If not, add a new row with key "Item 0".
  • Set the value of "Item 0" to "fb[appId]" where [appId] is your Facebook application ID. Make sure there are no spaces anywhere in this value. For example, if your application's id is 1234, the value should be "fb1234".

这篇关于facebook-ios-SDK问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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