![](/img/trans.png)
[英]Native Facebook app does not open with Facebook login in iOS 9
[英]IOS 9 Swift - Parse Facebook login does not open native Facebook App
我已将 Parse Framework 与所有 Facebook 依赖项集成到我的应用程序中。 我的 plist 配置如下所示:
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>fbXXXXXXXXXXXXX</string>
</array>
</dict>
</array>
<key>FacebookAppID</key>
<string>XXXXXXXXXXXXX</string>
<key>FacebookDisplayName</key>
<string>XXXXX</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>facebook.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
<key>fbcdn.net</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
<key>akamaihd.net</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
</dict>
</dict>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbauth2</string>
</array>
我的登录代码如下所示:
PFFacebookUtils.logInInBackgroundWithReadPermissions(permissionsArray, block: { (user, error) -> Void in
if(error != nil){
print("Login failed")
}else{
if let currentUser = user{
if(currentUser.isNew){
print("New user")
}else{
print("Login success")
}
}else{
print("Login canceled")
}
}
})
一切正常,但是登录过程是在 Safari 中完成的,而不是在已安装的 Facebook 应用程序中完成。
我错过了什么?
由于iOS 9,Facebook SDK不再通过Facebook App提供授权。 原因是在应用程序可以打开其他应用程序之前会提示用户,这会影响UX。
您唯一的选择是使用FBSDKLoginBehaviorSystemAccount或FBSDKLoginBehaviorBrowser
PFFacebookUtils.facebookLoginManager().loginBehavior = FBSDKLoginBehavior.SystemAccount
当我检查了本教程时,我将Facebook Login集成到我的应用程序中,希望对您有所帮助:
http://www.appcoda.com/ios-programming-facebook-login-manual/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.