アプリに Facebook ログインの統合の概念を実装しました。1----> Facebook ログインを行うことができましたが、ユーザー Facebook ログインの後、アプリを続行したいです。つまり、3 つのタブ項目を持つ 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];
UserProfile *userprofile=[[UserProfile alloc]initWithNibName:@"UserProfile" bundle:nil];
userprofile.title=@"My Profile";
LogOut *logout=[[LogOut alloc]initWithNibName:@"LogOut" bundle:nil];
logout.title=@"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;
}
}
];
}
}
しかし、ここではFacebookのログインページを表示せずにtabbarControllerを取得しており、ユーザーの詳細を取得できません。
Facebookのログインページを最初に表示してから、ユーザーの詳細を含むtabbarControllerを表示するにはどうすればよいですか?