簡體   English   中英

在未使用ios 6.0的iPhone設備上的Safari瀏覽器中,Facebook登錄是在Facebook本機應用程序中打開的

[英]Facebook Login is opening in Facebook Native app not in safari browser on iphone device with ios 6.0

您好,我正在使用FBSession打開登錄視圖,它在iOS5.0和ios 6.0 Simulator中打開了Safari進行登錄,但是在ios 6.0 iPhone中,它正在打開不是野生動物園的Facebook APP。請告訴我這是什么原因,怎么解決?我的Facebook登錄代碼。

- (BOOL)openSessionWithAllowLoginUI:(BOOL)allowLoginUI {
    return [FBSession openActiveSessionWithReadPermissions:nil
                                              allowLoginUI:allowLoginUI
                                         completionHandler:^(FBSession *session,
                                                             FBSessionState state,
                                                             NSError *error) {
                                             [self sessionStateChanged:session
                                                                 state:state
                                                                 error:error];
                                         }];
}

/*
 * Callback for session changes.
 */
- (void)sessionStateChanged:(FBSession *)session
                      state:(FBSessionState) state
                      error:(NSError *)error
{
    switch (state) {
        case FBSessionStateOpen:
            if (!error) {
                // We have a valid session
                NSLog(@"User session found");

                if ([[IntegrationManager sharedInstance] facebookDidLogin:nil]) {
                    [self.window.rootViewController dismissModalViewControllerAnimated:YES];
                };

            }
            break;
        case FBSessionStateClosed:NSLog(@"Fbsession close");
        case FBSessionStateClosedLoginFailed:
            [FBSession.activeSession closeAndClearTokenInformation];
            break;
        default:
            break;
    }

    [[NSNotificationCenter defaultCenter]
     postNotificationName:FBSessionStateChangedNotification
     object:session];

    if (error) {
        UIAlertView *alertView = [[UIAlertView alloc]
                                  initWithTitle:@"Error"
                                  message:error.localizedDescription
                                  delegate:nil
                                  cancelButtonTitle:@"OK"
                                  otherButtonTitles:nil];
        [alertView show];
    }
}

為了用戶方便,啟動了Facebook應用程序,而不是打開網站。 這樣做是為了使用戶不必再次登錄,這也稱為單點登錄。

如果您使用的是Facebook iOS SDK,那么您將無能為力。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM