2
我的应用程序登录屏幕在不打开Safari浏览器,Facebook登录尝试登录首次
在第一次尝试Facebook登录按钮没有打开Safari浏览器,而在第二尝试它工作正常。
下面是我试过的代码:首次将loginWithReadPermission
的调用,但回调块从未被称为
FBSDKLoginManager *manager = [FBSDKLoginManager new];
manager.loginBehavior = FBSDKLoginBehaviorBrowser;
NSArray *permissions = @[@"email",@"public_profile"];
[manager logInWithReadPermissions:permissions fromViewController:self handler:^(FBSDKLoginManagerLoginResult *result, NSError *error){
if(error) {
[self showAlertWith:@"Oops!" message:@"Login Failed, try again" handler:nil];
return;
}
if(result.isCancelled) {
[self showAlertWith:@"Oops!" message:@"Login Failed, try again" handler:nil];
return;
}else {
[[[FBSDKGraphRequest alloc] initWithGraphPath:@"me"
parameters:@{@"fields": @"picture, name, email"}]
startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id userinfo, NSError *error) {
if(!error) {
if([FBSDKAccessToken currentAccessToken]) {
[self makeGraphRequest];
}
}else {
EKLog(@"error %@", error);
}
}];
}
}];
点击登录按钮,而再次点击,回调处理程序被调用。任何帮助,将不胜感激。
请参阅:https://stackoverflow.com/a/40089906/3901620 – KKRocks