具体配置参考第三方后台配置—iOS版《二、Facebook第三方登录后台配置》
1、在facebook开发者平台创建一个Facebook应用,创建完之后会生成App ID和App Secret
这里的App ID要配置在项目当中,作为客户端与后台服务器连接的标识
2、在Xcode中配置相应的信息,主要是在info.plist文件中配置URL Schemes、FacebookAppID、FacebookDisplayName。注意一定要对应到facebook后台该App的App ID和Display Name。参考步骤1的截图。
3、针对iOS9做的一些配置
(1)Whitelist Facebook Servers for Network Requests
在info.plist增加下面配置
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
<key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key> <true/> <key>NSExceptionDomains</key> <dict> <key>facebook.com</key> <dict> <key>NSIncludesSubdomains</key> <true/> <key>NSThirdPartyExceptionRequiresForwardSecrecy</key> <false/> </dict> <key>fbcdn.net</key> <dict> <key>NSIncludesSubdomains</key> <true/> <key>NSThirdPartyExceptionRequiresForwardSecrecy</key> <false/> </dict> <key>akamaihd.net</key> <dict> <key>NSIncludesSubdomains</key> <true/> <key>NSThirdPartyExceptionRequiresForwardSecrecy</key> <false/> </dict> </dict> </dict> |
(2)Whitelist Facebook Apps
1 2 3 4 5 6 7 8 |
<key>LSApplicationQueriesSchemes</key> <array> <string>fbapi</string> <string>fb-messenger-api</string> <string>fbauth2</string> <string>fbshareextension</string> </array> |