I have implemented facebook login in my application.
1 ----> I was able to log in to facebook, but after that the logged in user will be able to continue his application, i.e. a tabbarController appears with three tabs, and at the same time I need to get facebook user data (email, firstname, lastname, etc.)
But I could not get the details. I do not understand where I am mistaken.
In my 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]; userprofile.title=@ "My Profile"; LogOut *logout=[[LogOut alloc]initWithNibName:@"LogOut" bundle:nil]; logout.title=@ "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; } } ]; } }
But here, without showing the facebook login page, I get a tabbarController and I cannot get user details.
How can I open facebook login page first and then tabbarController with user details? After successfully logging into facebook, how can I continue to work with my application using the tabbarcontroller with the first tabitem (corresponding view)?
Please help me sort this problem ... Please
source share