Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook Login issue iOS9 + Parse

Attempting to login with Facebook + Parse using the following code:

I notice when clicking the Login with Facebook button this shows up in the console twice.

-canOpenURL: failed for URL: "fbauth2://" - error: "This app is not allowed to query for scheme fbauth2"

Here is my code:

- (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!");
            }

        }];


}

I have added this to my plist as found in other topics, but still get the same error. [[EDITED TO ANSWER BELOW STILL SAME ISSUE]]

<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>
like image 896
Jamie22 Avatar asked Jan 21 '16 16:01

Jamie22


1 Answers

If you're recompiling with iOS SDK 9.0, add the following to your application's plist if you're using a version of the SDK v4.5 or older:

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

If you're using FBSDKMessengerShareKit from versions older than the v4.6 release, also add

<string>fb-messenger-platform-20150128</string>
<string>fb-messenger-platform-20150218</string>
<string>fb-messenger-platform-20150305</string>

If you're using v4.6.0 of the SDK, you only need to add:

<key>LSApplicationQueriesSchemes</key>
<array>
        <string>fbapi</string>
        <string>fb-messenger-api</string>
        <string>fbauth2</string>
        <string>fbshareextension</string>
</array>

Doc: https://developers.facebook.com/docs/ios/ios9

like image 146
Breek Avatar answered Sep 24 '22 23:09

Breek