Facebook登录问题iOS9 + Parse

Jam*_*e22 6 facebook objective-c ios parse-platform

尝试使用以下代码使用Facebook + Parse登录:

我注意到单击Login with Facebook按钮时,它会在控制台中显示两次.

-canOpenURL:URL失败:"fbauth2://" - 错误:"此应用程序不允许查询方案fbauth2"

这是我的代码:

- (IBAction)loginWithFacebook:(id)sender {
        // Set permissions required from the facebook user account
        NSArray *permissionsArray = @[ @"user_about_me", @"user_relationships", @"user_birthday", @"user_location"];

        // Login PFUser using Facebook
        [PFFacebookUtils logInWithPermissions: permissionsArray block:^(PFUser * _Nullable user, NSError * _Nullable error) {
            if (!user) {
                NSLog(@"Uh oh. The user cancelled the Facebook login.");
            } else if (user.isNew) {
                NSLog(@"User signed up and logged in through Facebook!");
            } else {
                NSLog(@"User logged in through Facebook!");
            }

        }];


}
Run Code Online (Sandbox Code Playgroud)

我已将其添加到我的plist中,如其他主题中所示,但仍然会出现相同的错误.[[编辑以下仍有同样的问题]]

<key>CFBundleURLTypes</key>
    <array>
        <dict>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>fb991863067537019</string>
            </array>
        </dict>
    </array>
    <key>FacebookAppID</key>
    <string>991863067537019</string>
    <key>FacebookDisplayName</key>
    <string>Ziplyne</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>fbapi</string>
           <string>fb-messenger-api</string>
           <string>fbauth2</string>
           <string>fbshareextension</string>
        </array>
Run Code Online (Sandbox Code Playgroud)

Bre*_*eek 2

如果您使用 iOS SDK 9.0 重新编译,并且使用的是 SDK v4.5 或更早版本,请将以下内容添加到应用程序的 plist 中:

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>fbapi</string>
    <string>fbapi20130214</string>
    <string>fbapi20130410</string>
    <string>fbapi20130702</string>
    <string>fbapi20131010</string>
    <string>fbapi20131219</string>    
    <string>fbapi20140410</string>
    <string>fbapi20140116</string>
    <string>fbapi20150313</string>
    <string>fbapi20150629</string>
    <string>fbauth</string>
    <string>fbauth2</string>
    <string>fb-messenger-api20140430</string>
</array>
Run Code Online (Sandbox Code Playgroud)

如果您使用的 FBSDKMessengerShareKit 版本早于 v4.6 版本,还请添加

<string>fb-messenger-platform-20150128</string>
<string>fb-messenger-platform-20150218</string>
<string>fb-messenger-platform-20150305</string>
Run Code Online (Sandbox Code Playgroud)

如果您使用的是v4.6.0的SDK,则只需添加:

<key>LSApplicationQueriesSchemes</key>
<array>
        <string>fbapi</string>
        <string>fb-messenger-api</string>
        <string>fbauth2</string>
        <string>fbshareextension</string>
</array>
Run Code Online (Sandbox Code Playgroud)

文档: https: //developers.facebook.com/docs/ios/ios9