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