2012-12-14 180 views
1

我已經在我的應用中實現了facebook登錄集成的概念。 1 ---->我能夠做Facebook的登錄,但用戶的Facebook登錄後,我想繼續我的應用程序,即一個tabbarController與三個選項卡項目出現,同時我需要獲取facebook用戶的詳細信息(電子郵件,名字,姓氏等)用ios6在xcode 4.5中從facebook獲取用戶詳細信息

但我無法檢索的細節。我不明白我哪裏錯了。

在我ViewController.m:

- (IBAction)performLogin:(id)sender 
{ 
    AppAppDelegate *appDelegate = (AppAppDelegate *) [[UIApplication sharedApplication] delegate]; 

    [appDelegate openSessionWithAllowLoginUI:YES]; 

    UITabBarController *tabBarController=[[UITabBarController alloc]init]; 
    SearchViewController *searchViewController=[[SearchViewController alloc]initWithNibName:@"SearchViewController" bundle:nil]; 

    UserProfile *userprofile=[[UserProfile alloc]initWithNibName:@"UserProfile" bundle:nil]; 
    [email protected]"My Profile"; 

    LogOut *logout=[[LogOut alloc]initWithNibName:@"LogOut" bundle:nil]; 

    [email protected]"Log Out"; 
    tabBarController.viewControllers=[NSArray arrayWithObjects:searchViewController,userprofile,logout, nil]; 

    [self presentModalViewController:tabBarController animated:YES]; 

    [[NSNotificationCenter defaultCenter] addObserver:self 
              selector:@selector(sessionStateChanged:) 
               name:FBSessionStateChangedNotification 
               object:nil]; 
} 

- (void)sessionStateChanged:(NSNotification*)notification { 

    if (FBSession.activeSession.isOpen) { 

     [FBRequestConnection 
     startForMeWithCompletionHandler:^(FBRequestConnection *connection, 
              id<FBGraphUser> user, 
              NSError *error) { 
      if (!error) { 
       NSString *fbUserEmail= @""; 

       NSLog(@"%@",user); 

       fbUserEmail=[user objectForKey:@"email"]; 

       AppAppDelegate *appDelegate = (AppAppDelegate *) [[UIApplication sharedApplication] delegate]; 

       appDelegate.fbEmail=fbUserEmail; 
      } 
     } 
     ]; 
    } 
} 

但在這裏不顯示我m到處tabbarController而我會無法得到檢索用戶信息的Facebook登錄頁面。

我怎樣才能顯示Facebook登錄頁面,然後tabbarController與用戶的詳細信息。

回答

相關問題