swift - Firebase 数据库不存储用户信息
问题描述
出于某种原因,没有任何内容存储到数据库中,我一直在使用相同的代码,并且在我不明白为什么它现在不起作用之前它可以工作
这是怎么做的:
//auth process above
ProgressHUD.showSuccess()
let when = DispatchTime.now() + 1
DispatchQueue.main.asyncAfter(deadline: when){
ProgressHUD.dismiss()
self.storeUserData(userId: (user?.user.uid)!) //original was (user?.uid)! but it seems that google has change it
KeychainWrapper.standard.set((user?.user.uid)!, forKey: "uid")
let TBVC = mainTabBarController()
self.present(TBVC, animated: true, completion: nil)
}
}
})
}
}
func storeUserData(userId: String) {
Database.database().reference().child("users").child(userId).setValue([
"username": username.text,
"password": password.text,
"email": email.text
])
}
解决方案
我会这样做并完成以查看错误
let dic = [
"username": username.text,
"password": password.text,
"email": email.text
]
Database.database().reference().child("users").child(userId).setValue(dic, withCompletionBlock: { (error, ref) in
print(error) // check error and see
})
推荐阅读
- r - 从 Windows 文件资源管理器加载 Rstudio 中的 .Rda 文件
- java - 给定扩展的 ASCII 代码点和 Java 中的代码页,找到等效的 Unicode 代码点?
- mysql - 存储引擎 MEMORY 不支持 FULLTEXT 索引
- powershell - 用于更新广告描述和计算机描述的脚本
- r - 不使用 for 循环计算人口(使用管道或其他方法)
- vue.js - Firestore,Vue.js,无法使用 .get() 从文档中获取价值
- typescript - 为什么类型保护不适用于 typeof 关键字,我该如何解决?
- python - 有没有办法只返回在另一列中有 True 和 False 的列中的名称?
- c++ - 在 Linux 中快速制作 Armadillo C++ 库 - Ubuntu
- c# - 使用 Stripe 的 Payment Intent API 接受 Xamarin 表单中的付款