2015-11-25 113 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中的姓和名。