我已经在我的应用程序中实现了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来继续使用我的应用程序?
请帮我在整理这个问题...请