Firebase值未被删除(Firebase value not being deleted)

编程入门 行业动态 更新时间:2024-10-22 15:24:48
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/-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()

更多推荐

本文发布于:2023-08-07 13:06:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1464241.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:未被   Firebase   deleted

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!