如何在Google Sign iOS中快速检索用户DOB和性别 [英] How to retrieve user DOB and Gender in Google Sign iOS in swift

查看:104
本文介绍了如何在Google Sign iOS中快速检索用户DOB和性别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在我的一个应用程序中使用google登录.我找不到找回出生日期和性别的方法.有人可以帮忙吗?这是我使用swift的代码-

I am using google sign In in one of my app. I cant find a way to retrieve Date of Birth and Gender. Can anybody please help. Here is my code using swift -

 func signIn(signIn: GIDSignIn!, didSignInForUser user: GIDGoogleUser!,
        withError error: NSError!) {
            if (error == nil) {

                // Perform any operations on signed in user here.
                let userId = user.userID                 
                let idToken = user.authentication.idToken              
                let name = user.profile.name
                let email = user.profile.email

                print(userId)
                print(idToken)
                print(email)
                print(name)
      } else {
                print("\(error.localizedDescription)")

            }
    }

推荐答案

您只能访问用户设置为公开的内容.如果用户不希望公开此信息,则您将无法获得该信息.

You can only access what a user has set to public. If the user doesn't want this information public then you cant have the information.

仅仅因为我对您的应用程序进行了身份验证,并不意味着我希望您例如看到我的地址,或者在这种情况下是我的性别.因此,我不会将它们设为公开,所以您看不到它们.

Just because I authenticate your application doesn't mean that I want you to for example to see my address or in this case my gender. So I don't set them public you cant see them.

这篇关于如何在Google Sign iOS中快速检索用户DOB和性别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆