1

Googleから携帯電話番号と生年月日を取得するための解決策を見つけることができません....

私を助けてください...

 @IBAction func onGoogleClick(sender: AnyObject) {

    var googleSignIn: GIDSignIn!


    googleSignIn = GIDSignIn.sharedInstance();
    googleSignIn.delegate = self
    googleSignIn.uiDelegate = self
    googleSignIn.shouldFetchBasicProfile = true;
    googleSignIn.clientID = "75749930852-g1qaafmntbrgendjea6bmk5g8e4684ue.apps.googleusercontent.com"
    googleSignIn.scopes.append("https://www.googleapis.com/auth/plus.login")

    googleSignIn.scopes.append("https://www.googleapis.com/auth/user.birthday.read")
    googleSignIn.scopes.append("https://www.googleapis.com/auth/user.phonenumbers.read")
    googleSignIn.scopes.append("https://www.googleapis.com/auth/userinfo.profile")
    googleSignIn.scopes.append("https://www.googleapis.com/auth/userinfo.email")
    googleSignIn.signIn();
}




public func sign(_ signIn: GIDSignIn!, didSignInFor user: GIDGoogleUser!, withError error: Error!) {

    if user != nil{

        if let name = user.profile.name as? String {
            self.txtFullName.text = name
        }

        if let email = user.profile.email as? String{
            self.txtEmail.text = email
        }


        if let gID = user.userID as? String {
            self.registerID = gID
            self.registerType = UserRegisterType.GOOGLE
        }
    }



}
4

0 に答える 0