2015-11-25 112 views
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] 
     } 

回答

0

「名稱」,提交包含名和姓

示例「名」 =阿倫·史密斯

然後名字=阿倫和姓=史密斯

否則無法獲得使用谷歌登錄在IOS中的姓和名。