Firebase不会在数据库中的ref下创建子级

时间:2017-12-26 07:08:28

标签: swift firebase firebase-realtime-database

我正在尝试创建一个iOS应用程序,根据他们输入的性别将男孩和女孩分别存放在firebase中。但是在下面的代码中,当我尝试创建一个节点时,它只会创建它,如果我将ref的子名称为“users”,否则不起作用。

let ref = FIRDatabase.database().reference()

//makes a child of ref called user                    
let usersReference = ref.child("users") //PROBLEM IS HERE, IF I NAME IT ANYTHING OTHER THAN USERS, IT DOES NOT SAVE IN THE DATABASE

let uid = user?.uid
let newUserReference = usersReference.child(uid!)
newUserReference.setValue(["email": self.emailField.text!])

0 个答案:

没有答案