URL失败:“fbauth2:/” - 错误:“操作无法完成。(OSStatus错误-10814。)”iOS10上的+ com.facebook.sdk.login Code = 308“(null)

时间:2018-03-06 08:01:27

标签: ios objective-c facebook

我正在尝试将Facebook登录集成到我的IOS应用程序中,有两种情况,第一种情况如下:

  FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];
    [login logOut];
    [login logInWithReadPermissions:@[@"public_profile", @"email"] fromViewController:self handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) {
        if (error) {
            [self hideLoader];
            [self showAlertRequestError];
        }
        else if (result.isCancelled) {
            [self hideLoader];
        }
        else {
             [self facebookGetValuesFromSession:result];
        }
    }];

   - (void)facebookGetValuesFromSession:(FBSDKLoginManagerLoginResult *)loginResult
        {
            FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] initWithGraphPath:@"me" parameters:[NSDictionary dictionaryWithObjectsAndKeys:@"id,email,first_name,last_name,gender", @"fields",nil]];
            [request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
                if (!error) {
                    //            self.user = [User new];
                    self.fbID = [result verifiedStringForKey:@"id"];
                    self.fbEmail = [result verifiedStringForKey:@"email"];
                    self.fbFirstName = [result verifiedStringForKey:@"first_name"];
                    self.fbLastName = [result verifiedStringForKey:@"last_name"];
                    self.fbGender = [result verifiedStringForKey:@"gender"];
                    self.fbToken = FBSDKAccessToken.currentAccessToken.tokenString;
    .
    .
    .
        }
        }
    }

当我按下Facebook登录按钮时,它会将我带到Facebook页面并显示一条消息:您之前使用Facebook登录到XXXX。你想继续吗? 当我按下继续时,它将我带到一个空白页面,xcode给我这个错误:-canOpenURL:URL失败:“fbauth2:/” - 错误:“操作无法完成。(OSStatus错误-10814。 )“

第二个Senario,如果我将这一行添加到代码中:

login.loginBehavior = FBSDKLoginBehaviorWeb;

当我输入用户名和密码,然后按登录时,我会收到此错误:

Error Domain=com.facebook.sdk.login Code=308 "(null)"

我已在target->功能中启用了keychane共享,如问题所示:here

0 个答案:

没有答案