iOS Facebook

1. 需要注册facebook的developer帐户

     developers.facebook.com

    

2. 然后添加你的app,这样你会得到app id

    developers.facebook.com/app

3. 将得到app id加入到你的xcode的工程的 .plist文件中,方法是添加新的一行,名字为FacebookAppID,值为你刚得到的值。

     如果没有这一步,就会导致你在点击登陆,切换到safari的时候,会提示打开失败,原因是你没有提供FacebookAppID或者FacebookAppID的值是无效的。

     

4. 点击okay按钮,弹出

Cannot Open Page

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”.

版权所有,禁止转载. 如需转载,请先征得博主的同意,并且表明文章出处,否则按侵权处理.

    分享到:

留言

你的邮箱是保密的 必填的信息用*表示