Retrieve randomly generated child ID from Firebase

前端 未结 4 1441
青春惊慌失措
青春惊慌失措 2021-02-03 12:53

I have Firebase generating random keys for my records in a Swift app. How do I go about retrieving that key if I want to change a specific record? In my example below, I\'m mark

4条回答
  •  抹茶落季
    2021-02-03 13:33

    An alternative to Ron's answer involves generating the key first and then using it to set value:

    let autoId = databaseReference.childByAutoId().key
    databaseReference.child(autoId).setValue(YOUR_VALUE)
    

提交回复
热议问题