在我的应用中,我尝试从Firebase数据库获取用户信息,但它始终返回null。这是我从数据库中读取当前用户信息的代码
func workWithDataBase(){
let email = "test@gmail.com"
let password = "test23"
FIRAuth.auth()?.signIn(withEmail: email, password: password, completion: { (user, error) in
if error != nil {
print(error)
return
} else {
print("SIGNED IN\n")
let uid = FIRAuth.auth()?.currentUser?.uid
FIRDatabase.database().reference().child("users").child(uid!).observeSingleEvent(of: .value, with: { (snapshot) in
print(snapshot)
}) {
(error) in
print(error.localizedDescription)
}
}
})
}
我的问题是,如果电子邮件和名称的字段不为空,为什么" observeSingleEvent"方法返回null?我该如何解决这个问题?
答案 0 :(得分:1)
试试这个: -
java -cp <my-classpath-here> com.mapreduce.WordCount <input-path> <output-path>