我已經在我的應用程序中實現了Facebook登錄。集成facebook登錄和獲取用戶詳細信息以及tabbarcontroller在ios6
1 ---->我能夠做Facebook登錄,但之後,登錄用戶可以繼續我的應用程序,即出現一個tabbarController與三個選項卡項目,同時我需要獲取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];
UProfile *uprofile=[[UProfile alloc]initWithNibName:@"UProfile" bundle:nil];
[email protected]"My Profile";
LogOut *logout=[[LogOut alloc]initWithNibName:@"LogOut" bundle:nil];
[email protected]"Sign out";
tabBarController.viewControllers=[NSArray arrayWithObjects:searchViewController,uprofile,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;
}
}
];
}
}
但在這裏不顯示我正在tabbarController,我無法獲取用戶信息的Facebook登錄頁面。
我該如何顯示Facebook登錄頁面,然後顯示帶有用戶詳細信息的tabbarController? 成功登錄Facebook之後,如何選擇第一個tabitem(相應視圖)的tabbarcontroller來繼續使用我的應用程序?
請幫我在整理這個問題...請