Take the 2-minute tour ×

I have implemented the concept of integration of facebook login in my app. 1----> I was able to do facebook login but after the user facebook login I want to continue with my app i.e a tabbarController with three tab items appears and simultaneously I need to fetch facebook user details (email,firstname,lastname etc)

But I was unable to retrieve details. I do not understand where I m going wrong.

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];

    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

- (void)sessionStateChanged:(NSNotification*)notification {

    if (FBSession.activeSession.isOpen) {

         startForMeWithCompletionHandler:^(FBRequestConnection *connection,
                                           id<FBGraphUser> user,
                                           NSError *error) {
             if (!error) {
                 NSString *fbUserEmail= @"";


                 fbUserEmail=[user objectForKey:@"email"];



But here without showing facebook login page I m getting tabbarController and I m unable to get retrieve user details.

How can I show facebook login page first and then tabbarController with user details.?

share|improve this question

1 Answer 1

up vote 5 down vote accepted

You can fetch facebook user details by using Facebook Graph API, Below Link demonstrate the use of Graph API to get basic user details. Check here: http://www.raywenderlich.com/1578/how-to-get-a-user-profile-with-facebooks-new-graph-api-from-your-iphone-app

share|improve this answer
Hey I m using xcode4.5 with ios6.Will it work for that? –  Sindhia Dec 15 '12 at 4:58
Yes, Facebook has also updated their API for latest version of xcode and ios as well. –  Vinay Bagale Dec 16 '12 at 15:35

Your Answer


