The operation couldn’t be completed. (com.facebook.sdk error 2.) ios6

后端 未结 7 852
误落风尘
误落风尘 2020-11-30 05:54

Hi i am ussing ios6 for facebook login and i am getting this error as native popup

The operation couldn’t be completed. (com.facebook.sdk error 2.)

This is

7条回答
  •  隐瞒了意图╮
    2020-11-30 06:27

    This worked for me:

    • Go to the settings app of your iPhone.
    • Open your Facebook Settings
    • Scroll down to your app and make sure your app allows facebook interaction.

    This could happen on any device, therefore in your app you will have to make sure to handle this error correctly. I reckon you give the user feedback why Login With Facebook failed and ask the user to check their Facebook settings on their device.

     - (void)facebookSessionStateChanged:(FBSession *)session state:(FBSessionState)state error:(NSError *)error
    {
        switch (state) {
            case FBSessionStateOpen:
                // handle successful login here
            case FBSessionStateClosed:
            case FBSessionStateClosedLoginFailed:
                [FBSession.activeSession closeAndClearTokenInformation];
    
                if (error) {
                    // handle error here, for example by showing an alert to the user
                    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Could not login with Facebook"
                                                                    message:@"Facebook login failed. Please check your Facebook settings on your phone."
                                                                   delegate:nil
                                                          cancelButtonTitle:@"OK"
                                                      otherButtonTitles:nil];
                    [alert show];
                }
                break;
            default:
                break;
        }
    

提交回复
热议问题