2012-12-14 150 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与用户的详细信息。

回答

相关问题