0
我想與谷歌登錄,但我不能得到用戶的姓氏......谷歌登錄在迅速
如何獲得用戶名,姓什麼?
我用這個代碼:
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]
}