Firebase值未被删除(Firebase value not being deleted)
我试图从Firebase删除一个孩子,但是,由于某种原因,它没有删除它。
这就是我如何删除它(我得到正确的参考):
FIRDatabase.database().reference().child("posts").child(commentsArray[indexPath.row].key).removeValue()如果我尝试po这个值输出是例如:
https://snuspedia.firebaseio.com/posts/coments/-KTzfD1wOa9sRXw93gAF
这是这个:
难道我做错了什么?
I tried to delete one child from Firebase, however, it is not removing it for some reason.
This is how I tied to delete it(I get the right reference):
FIRDatabase.database().reference().child("posts").child(commentsArray[indexPath.row].key).removeValue()If I try to po this value the output is e.g:
https://snuspedia.firebaseio.com/posts/coments/-KTzfD1wOa9sRXw93gAF
Which is this:
Am I doing something wrong?
最满意答案
所以我认识到你错过了帖子的关键:
https://snuspedia.firebaseio.com/posts/<KEY OF YOUR POST>/comments/-KTzfD1wOa9sRXw93gAF参考代码应包含特定帖子的关键字:
FIRDatabase.database().reference().child("posts").child(<KEY OF YOUR POST>).child("comments").child(commentsArray[indexPath.row].key).removeValue()So what I recognize is that you miss the key of the post:
https://snuspedia.firebaseio.com/posts/<KEY OF YOUR POST>/comments/-KTzfD1wOa9sRXw93gAFReference 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()更多推荐
发布评论