[英]how to delete child record from firebase in swift?
I wanted to delete this record in firebase
, where i don't have the name of the key. 我想在
firebase
删除此记录,我没有密钥的名称。 so, I don't know how to do it. 所以,我不知道该怎么做。 can anybody help me with this?
有人可以帮我吗?
The code for getting array is as follows 获取数组的代码如下
var databaseRefer : DatabaseReference!
let userID = Auth.auth().currentUser?.uid
databaseRefer = Database.database().reference(withPath: userID!)
databaseRefer.observeSingleEvent(of: .value, with: { snapshot in
if !snapshot.exists() { return }
if snapshot.value is NSNull {
print("not found")
} else {
for child in snapshot.children {
let snap = child as! DataSnapshot
print(dict)
dict.forEach { item in
print(item.value)
}
}
}
})
https://firebase.google.com/docs/database/ios/read-and-write https://firebase.google.com/docs/database/ios/read-and-write
"The simplest way to delete data is to call removeValue on a reference to the location of that data." “删除数据的最简单方法是在对数据位置的引用上调用removeValue。”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.