firebase uid总是返回零

时间:2017-01-07 13:29:05

标签: ios swift firebase firebase-authentication

她是我的数据库/规则:

{
  "rules": {
    ".read": true,
    ".write": true
  }
}

我正在尝试两种方式它给我nil

 FIRAuth.auth()?.createUser(withEmail: email, password: pass, completion: { (firuser, error) in

     if error != nil {
    print("error goes when try to user authenticated :) \(error)")
  }

  print("firuser : \(firuser)")

  print("FIRAuth.auth()?.currentUser?.uid : \(FIRAuth.auth()?.currentUser?.uid)")

  print("firuser?.uid : \(firuser?.uid)")

  guard let userUID = firuser?.uid  else{
     print("user UID  not found. should go stackoverflow ")
  return
  }

      guard let userUID = firuser?.uid  else{
         print("user UID  not found. should go stackoverflow ")
      return
      }
})

控制台日志:

错误:

  

可选(错误域= FIRAuthErrorDomain代码= 17995"访问钥匙串时发生错误。@ c NSError.userInfo字典中的@c NSLocalizedFailureReasonErrorKey字段将包含有关遇到的错误的更多信息" UserInfo = {NSLocalizedDescription =访问密钥链时发生错误。@ c NSError.userInfo字典中的@c NSLocalizedFailureReasonErrorKey字段将包含有关遇到的错误的更多信息,error_name = ERROR_KEYCHAIN_ERROR,NSLocalizedFailureReason = SecItemAdd(-34018)})

     

firuser:零   FIRAuth.auth()?currentUser?.uid:nil
  firuser?.uid:nil

服务器用户添加:

enter image description here

1 个答案:

答案 0 :(得分:4)

我遇到了同样的问题..但是这样解决了

转到* .xcodeproj

转到标签"功能"

激活"钥匙串共享"