Firebase快速删除快照的孩子 [英] Firebase remove snapshot children swift
问题描述
我正在使用 Firebase
作为我的数据库...
然后我想删除 但它崩溃在 我终于找到了一个解决方案: I am using Then i want to delete the but it crashes at Hello there i finally find a solution: Thanks a lot! 这篇关于Firebase快速删除快照的孩子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!codigo
键值。这是我的if语句:
$ b $ pre $ let profile = FIRDatabase.database()。reference()。child(barcodes)
profile.observeEventType(.Value,withBlock:{(snapshot) - >在
中无效作为snapshot.children中的物品{
如果物品.value [codigo] as!String ==条形码[indexPath.row] .code {
print(HERE)
item.removeValue!()
$ / code> item.removeValue()
。
$ b $ $ p $ let profile = FIRDatabase.database()。reference()。child(barcodes)
profile.observeEventType(.Value,withBlock:{(snapshot) - > Void in
if snapshot.exists(){
for item在snapshot.children {
如果我tem.value [ codigo]作为! String == barcodes [index] .code {
item.ref.child(item.key!)。parent?.removeValue()
}
}
)
$ / code $ / pre
$ b $ p Firebase
as my Database...
"codigo"
key value. This is my if statement:let profile = FIRDatabase.database().reference().child("barcodes")
profile.observeEventType(.Value, withBlock: { (snapshot) -> Void in
for item in snapshot.children {
if item.value["codigo"]as! String == barcodes[indexPath.row].code{
print("HERE")
item.removeValue!()
}
}
item.removeValue()
. let profile = FIRDatabase.database().reference().child("barcodes")
profile.observeEventType(.Value, withBlock: { (snapshot) -> Void in
if snapshot.exists(){
for item in snapshot.children {
if item.value["codigo"]as! String == barcodes[index].code{
item.ref.child(item.key!).parent?.removeValue()
}
}
}
})