简体   繁体   中英

iOS Facebook latest SDK cannot login through native App but browser

i just download and update existing Facebook SDKs. After update, i found my app cannot login through facebook native login screen. It show web site login. Anyone can help on this issue? i am using original facebook login button. code below is the way i use it

loginButton:(FBSDKLoginButton *)loginButton didCompleteWithResult:(FBSDKLoginManagerLoginResult *)result error:(NSError *)error{
       if (error) {
          alertMessage = @"Facebook Process Error";
       }
       else if (result.isCancelled) {
           alertMessage = @"Cancelled Login";
       }
       else
       {
           [self getFbUserData];
       }
}

-(void)getFbUserData{
     [[[FBSDKGraphRequest alloc] initWithGraphPath:@"me" parameters:nil]
 startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {

     if (!error) {
         fbID = result[@"id"];
         [self FacebookRegToServer:result[@"id"] facebookName:result[@"name"]];
         self.statusLabel.text = [NSString stringWithFormat:@"%@ %@",@"You're logged in as",result[@"name"]];


     }
 }];
}

TLDR: By Design.

The reason for this is that Facebook doesn't want to pop up an alert asking you to open Facebook every time you login with apps that integrate the SDK, therefore they will always pop up a webview. More on this here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM