简体   繁体   English

如何在Google中获取用户的出生日期和性别以及iOS中最新的SDK版本2.1.0

[英]How to get user Date of birth and gender in google plus latest SDK version 2.1.0 in ios

I am using sign in with Google plus, I updated Google Plus SDK version with 2.1.0,follow with the instruction on, https://developers.google.com/identity/sign-in/ios/quick-migration-guide link, but I am not getting user's DOB and his/her gender in user info. 我正在使用Google Plus登录,我用2.1.0更新了Google Plus SDK版本,请按照https://developers.google.com/identity/sign-in/ios/quick-migration-guide链接上的说明进行操作,但我没有在用户信息中得到用户的DOB及其性别。

I am using this delegate method for get user detail, 我正在使用此委托方法来获取用户详细信息,

- (void)signIn:(GIDSignIn *)signIn didSignInForUser:(GIDGoogleUser *)user
     withError:(NSError *)error {
    // Perform any operations on signed in user here.
    NSString *userId = user.userID;                  // For client-side use only!
    NSString *idToken = user.authentication.idToken; // Safe to send to the server
    NSString *name = user.profile.name;
    NSString *email = user.profile.email;
}

If any one know how to get user's gender and DOB then Please help me. 如果有人知道如何获取用户的性别和DOB,请帮助我。

Thanks in advance. 提前致谢。

Your problem may not be with your code. 您的问题可能与代码无关。 Birthday and gender info is not always visible. 生日和性别信息并非始终可见。 I have tested it using Try It . 我已经使用Try It对其进行了测试。 I tested it with all of the different scopes 我在所有不同的示波器上进行了测试

https://www.googleapis.com/auth/plus.login Know your basic profile info and list of people in your circles. https://www.googleapis.com/auth/plus.login知道您的基本个人资料信息和您圈子中的人员列表。

https://www.googleapis.com/auth/plus.me Know who you are on Google https://www.googleapis.com/auth/userinfo.email View your email address https://www.googleapis.com/auth/userinfo.profile View basic information about your account https://www.googleapis.com/auth/plus.me知道您在Google上的身份https://www.googleapis.com/auth/userinfo.email查看您的电子邮件地址https://www.googleapis.com/ auth / userinfo.profile查看有关您帐户的基本信息

It doesn't appear to matter you get back the birthday in all of the scopes. 在所有范围内恢复生日似乎并不重要。 But what does matter is that the Users Birthday must be set to public in the Account. 但是重要的是,必须在帐户中将“用户生日”设置为public If its set to anything else, your circles, only you. 如果将其设置为其他任何值,您的圈子中只有您自己。 its not listed. 其未列出。 This appears to be true even when you are trying to see your own information. 即使您尝试查看自己的信息,这似乎也是正确的。 (Sending Me) (发送给我)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM