从Facebook登录获取电子邮件地址

时间:2014-02-08 17:16:27

标签: ios facebook facebook-login facebook-sdk-3.0

今天我尝试从iOS应用程序进行Facebook登录。我按照developer.facebook.com指南,但我遇到了问题。我想获取登录用户的电子邮件地址。在网上搜索我发现函数[user objectFromKey @“email”],但它对我不起作用。这是我的代码:

@interface FLTViewController ()

@end

@implementation FLTViewController
@synthesize profilePictureView;
@synthesize nameLabel;
@synthesize statusLabel;

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.

    FBLoginView *loginView =
    [[FBLoginView alloc] initWithReadPermissions:@[@"basic_info", @"email", @"user_likes",@"export_stream"]];


    loginView.delegate = self;

}

- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}

- (void)loginViewFetchedUserInfo:(FBLoginView *)loginView
                            user:(id<FBGraphUser>)user {
    self.profilePictureView.profileID = user.id;
    self.nameLabel.text = user.id;
    self.statusLabel.text = [user  objectForKey: @"email"];
}


- (void)loginViewShowingLoggedOutUser:(FBLoginView *)loginView {
    self.profilePictureView.profileID = nil;
    self.nameLabel.text = @"";
    self.statusLabel.text= @"You're not logged in!";
}

@end

有人可以帮助我吗?

0 个答案:

没有答案
相关问题