facebook app测试每个人

1 facebook app-id ios facebook-ios-sdk

我创建了一个Facebook应用程序.我测试了它sandbox mode,它很好.

现在我想让其他人在手机上测试这个应用程序,所以我关闭sandbox mode,我发现iPhone-5用户无法登录,但它仍然可以在android手机中正常工作

这是错误日志 -

会话创建错误:错误Domain = com.facebook.sdk Code = 2"操作无法完成.(com.facebook.sdk error 2.)"UserInfo = 0x16561ad0

我检查了我的bundle idapp id,它不出差错

sil*_*eep 7

这对我有用:

转到iPhone的设置应用程序.打开您的Facebook设置向下滚动到您的应用程序,并确保您的应用程序允许Facebook交互.这可能发生在任何设备上,因此在您的应用程序中,您必须确保正确处理此错误.我估计你向用户提供反馈为何登录Facebook失败并要求用户在他们的设备上检查他们的Facebook设置.

- (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];

        // 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;
}
Run Code Online (Sandbox Code Playgroud)