0

I'm using the the PFLogInViewController of the ParseUI framework. I have two questions related to emails with regards to Facebook Login within the framework:

1) When signing up via Facebook, I see that the email field of my new user is 'undefined.' How can I obtain the user's email address?

2) If I am able to obtain the email address, does parse's application setting of 'emailVerified' still send a verification email to the user upon Facebook signup? If not, how can this be done?

Thanks.

4

1 回答 1

1

为了读取用户的电子邮件地址,您需要将电子邮件添加到您请求的 Facebook 权限数组中。查看此https://www.parse.com/tutorials/login-and-signup-views#properties上的 Parse 教程

在您的情况下,您需要@"email"像这样添加:

[logInViewController setFacebookPermissions:[NSArray arrayWithObjects:@"friends_about_me", @"email", nil]];

然后,当您从 Facebook 请求用户信息时,您将能够访问用户的电子邮件地址:

FBRequest *request = [FBRequest requestForMe];
        [request startWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error) {

            if (!error) {
                // Now you can access user's email
                NSString *email = result[@"email"];
                if (email) {
                    // Save it to your email field in Parse
                }
            }
        }];

关于您问题的第 2 部分,我对 Parse 支持的电子邮件验证功能不太熟悉,但看看这个(诚然旧的)响应https://www.parse.com/questions/email-verification-emails-going -out-to-facebook-users似乎 Parse 会验证电子邮件地址,即使用户使用 Facebook 登录也是如此。

于 2015-03-07T15:57:35.483 回答