Tarvo Mäesepp Tarvo Mäesepp - 1 year ago 74
Swift Question

Firebase value not being deleted

I tried to delete one child from Firebase however it is not removing it for some reason.

That is how I tied to delete it(I get the right reference):


If I try to
this value the output is e.g:


Which is this:enter image description here

Am I doing something wrong?

Answer Source

So what I recognize is that you miss the key of the post:

https://snuspedia.firebaseio.com/posts/<KEY OF YOUR POST>/comments/-KTzfD1wOa9sRXw93gAF

Reference code should include the key of the specific post:

FIRDatabase.database().reference().child("posts").child(<KEY OF YOUR POST>).child("comments").child(commentsArray[indexPath.row].key).removeValue()
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download