谷歌登录swift
我想登录谷歌,但我不能得到用户的姓氏 如何获取用户的名字、姓氏 我使用以下代码:谷歌登录swift,swift,google-signin,Swift,Google Signin,我想登录谷歌,但我不能得到用户的姓氏 如何获取用户的名字、姓氏 我使用以下代码: withError error: NSError!) { if (error == nil) { // Perform any operations on signed in user here. let userId = user.userID // For client-side use only!
withError error: NSError!) {
if (error == nil) {
// Perform any operations on signed in user here.
let userId = user.userID // For client-side use only!
let idToken = user.authentication.idToken // Safe to send to the server
let name = user.profile.name
let email = user.profile.email
// [START_EXCLUDE]
NSNotificationCenter.defaultCenter().postNotificationName(
"ToggleAuthUINotification",
object: nil,
userInfo: ["statusText": "Signed in user:\n\(name)"])
// [END_EXCLUDE]
} else {
print("\(error.localizedDescription)")
// [START_EXCLUDE silent]
NSNotificationCenter.defaultCenter().postNotificationName(
"ToggleAuthUINotification", object: nil, userInfo: nil)
// [END_EXCLUDE]
}
名称字段包含名字和姓氏 示例名称=阿伦·史密斯 然后名字=阿伦,姓氏=史密斯 否则,无法在IOS中使用谷歌登录获取姓名