Firebase实时数据库iOS删除密钥



我的iOS应用程序上有一个可用的实时数据库。现在正在尝试从客户端添加功能以删除其user_id和历史记录。根据文档,将是removeValue函数。然而,当我跑步时,我收到了一个快速的错误。这是我的代码:

self.roofRef.child(user_name as! String).childByAutoId().setValue(dict)
let conditionRef_ex = self.roofRef.child(user_name as! String)
conditionRef_ex.observe(.value) { (snap: DataSnapshot) in
let _tester = snap.value.debugDescription
// here is line of code to remove user, which is causing the error    
self.roofRef.removeValue(completionBlock: user_name as! (Error?, DatabaseReference) -> Void)

我看到:你必须填充removeValue方法的完成块。。。您还可以通过将nil指定为另一个写操作(如setValue或updateChildValues(的值来进行删除。

最新更新