Shl*_*rtz 10 facebook ios oauth-2.0 parse-framework swift
我已将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>
Run Code Online (Sandbox Code Playgroud)
我的登录代码如下所示:
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")
}
}
})
Run Code Online (Sandbox Code Playgroud)
一切正常,但登录过程在Safari中完成,而不是在已安装的Facebook应用程序中完成.
我错过了什么?
由于iOS 9 Facebook SDK不再通过Facebook App提供授权.原因是在应用程序打开其他应用程序之前会提示用户,这会影响用户体验.
您唯一的选择是使用FBSDKLoginBehaviorSystemAccount或FBSDKLoginBehaviorBrowser
PFFacebookUtils.facebookLoginManager().loginBehavior = FBSDKLoginBehavior.SystemAccount
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1868 次 |
| 最近记录: |