简体   繁体   English

如何快速删除Firebase中的子记录?

[英]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.

相关问题 如何从 Firebase (Swift) 中删除一个孩子 - How to delete a child from Firebase (Swift) 如何使用Swift从UITableViewCell删除Firebase中的特定子节点 - How can I delete a specific child node in Firebase from UITableViewCell using Swift 如何在2小时后自动删除孩子(firebase swift 4)? - How delete child after time 2 hours automatic ( firebase swift 4)? 如何从另一个孩子那里查询一个孩子。 Firebase(SWIFT) - How to query a child from another child. Firebase(SWIFT) 如何在FMDB Swift 3中删除记录 - How to delete record in FMDB swift 3 如何从特定的UICollectionViewCell中删除Firebase子节点-Swift - How to remove a firebase child node from a specific UICollectionViewCell - Swift 如何从 Firebase 单击 TableViewCell - SWIFT 获取当前子项(AutoID)? - How to get current child (AutoID) from Firebase clicking TableViewCell - SWIFT? 如何从 Firebase 存储和表视图中删除文件 - Swift - How to delete files from Firebase Storage and Table View - Swift 如何从 swift 的 Firebase Firestore 中删除当前用户的特定文档? - How to delete specific document for the current user from Firebase Firestore in swift? swift Firebase删除所有具有给定值的快照子 - swift Firebase delete all snapshot child with given value
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM