Search code examples
iosfacebookfacebook-loginios9

iOS 9 Facebook permissions failing


I am using Xcode 7 beta 6, iOS 9 beta 5.
In my existing code (which works in iOS 7 & 8) I have this:

FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];

        [login logInWithPublishPermissions:@[@"manage_pages"] handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) {
            if (error) {
                NSLog(@"There was an error with FB:\n %@",error.description);
            } else if (result.isCancelled) {

            } else {
                if ([result.grantedPermissions containsObject:@"manage_pages"]) {
                    NSLog(@"permissions granted! %@",[[FBSDKAccessToken currentAccessToken]permissions]);
                    // Do work
                    [self facebookInfo];
                }else{
                    NSLog(@"permissions NOT granted");
                }
            }
        }];

As soon as the application switches over to either the Facebook app or Safari, the handler throws the error

There was an error with FB:
 Error Domain=com.facebook.sdk.login Code=301 "(null)"

On the device, the permission page is shown in Safari and once you agree to the permissions you are prompted about Safari wanting to open my app back up. Once the application reopens nothing happens, which makes sense considering that the handler has already failed.
Can anyone shed any light on this? I'm struggling to find any other examples of this.
Thanks a lot,
Luke


Solution

  • The resolution to this issue was that the facebook SDK appears to be buggy.
    After downgrading my project pod files to:

    pod 'FBSDKCoreKit', '~> 4.2.0'
    pod 'FBSDKLoginKit', '~> 4.1.0'
    pod 'FBSDKShareKit', '~> 4.1.0' 
    

    I found that this error went away and normal operation was resumed.
    This appears to be a bit of a widely-found bug that has started cropping up on other SO questions.