OStack程序员社区-中国程序员成长平台

标题: ios - FBLoginView 未收到用户电子邮件 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 23:57
标题: ios - FBLoginView 未收到用户电子邮件

当我这样做时:

- (void) viewDidLoad {
  [_fbLoginView setReadPermissions[@"public_profile", @"email"]];
  [_fbLoginView setDelegate:self];
}

- (void)loginViewFetchedUserInfoFBLoginView *)loginView
                            userid<FBGraphUser>)user {
  self.profilePictureView.profileID = user.id;
  self.nameLabel.text = user.name;
}

我刚刚得到:

(lldb) po user
{
    "first_name" = Name;
    gender = female;
    id = 1459547723244130;
    "last_name" = Surname;
    link = "https://www.facebook.com/app_scoped_user_id/1459547723244130/";
    locale = "en_US";
    name = "Name Surname";
    timezone = 1;
    "updated_time" = "2014-06-30T08:07:59+0000";
    verified = 1;
}

即使我被告知申请需要我的电子邮件地址。

如何使用 FBLoginView 从 Facebook 获取用户电子邮件?



Best Answer-推荐答案


检查权限点击Here

enter image description here

viewController.h

@interface ViewController : UIViewController<FBLoginViewDelegate>

viewController.m

- (void)viewDidLoad {
    [super viewDidLoad];

    FBLoginView *loginView = [[FBLoginView alloc] init];
    loginView.center = self.view.center;
    loginView.readPermissions = @[@"public_profile", @"email", @"user_friends"];
    [loginView setDelegate:self];
    [self.view addSubview:loginView];
    // Do any additional setup after loading the view, typically from a nib.
}

登录成功后调用波纹管委托(delegate)方法

- (void)loginViewFetchedUserInfoFBLoginView *)loginView
                            userid<FBGraphUser>)user {

 self.profilePictureView.profileID = user.id;
  self.nameLabel.text = user.name;

}

关于ios - FBLoginView 未收到用户电子邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24880322/






欢迎光临 OStack程序员社区-中国程序员成长平台 (https://ostack.cn/) Powered by Discuz! X3.4