1

アプリに 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を表示するにはどうすればよいですか?

4

1 に答える 1

4

Facebook Graph API を使用して Facebook ユーザーの詳細を取得できます。以下のリンクは、Graph API を使用して基本的なユーザー詳細を取得する方法を示しています。ここをチェックしてください:http ://www.raywenderlich.com/1578/how-to-get-a-user-profile-with-facebooks-new-graph-api-from-your-iphone-app

于 2012-12-14T16:08:52.960 に答える