2012-12-14 1 views
1

내 앱에서 Facebook 로그인 통합 개념을 구현했습니다. 1 ----> 페이스 북 로그인을 할 수 있었지만 사용자 페이스 북 로그인 후에 내 앱 즉, 세 개의 탭 항목이있는 tabbarController가 계속 나타나고 동시에 페이스 북 사용자 세부 정보 (이메일, 성, 성)를 가져와야합니다. 등)ios6을 사용하여 xcode 4.5의 페이스 북에서 사용자 세부 정보 가져 오기

그러나 세부 정보를 검색 할 수 없습니다. 나는 내가 어디로 잘못 가고 있는지 이해하지 못한다. 내 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]; 
    [email protected]"My Profile"; 

    LogOut *logout=[[LogOut alloc]initWithNibName:@"LogOut" bundle:nil]; 

    [email protected]"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; 
      } 
     } 
     ]; 
    } 
} 

그러나 여기에 내가 tabbarController을 받고 있어요 내가 사용자의 세부 정보를 검색 얻을 수 없습니다 해요 페이스 북의 로그인 페이지를 표시하지 않고

.

먼저 페이스 북 로그인 페이지를 표시 한 다음 사용자 세부 정보가있는 tabbarController를 표시 할 수 있습니까?

답변

4

Facebook Graph API, Below Link를 사용하여 기본 사용자 세부 정보를 얻기 위해 Graph API를 사용하는 방법을 보여줌으로써 Facebook 사용자 세부 정보를 가져올 수 있습니다. 여기를 확인하십시오 : http://www.raywenderlich.com/1578/how-to-get-a-user-profile-with-facebooks-new-graph-api-from-your-iphone-app

+0

안녕하세요 저는 xcode4.5와 ios6을 사용하고 있습니다. 그게 효과가 있습니까? – Sindhia

+0

예, 페이스 북은 최신 버전의 xcode 및 ios에 대한 API도 업데이트했습니다. –

관련 문제