【发布时间】:2019-04-02 22:58:42
【问题描述】:
我使用 childByAutoId 在我的 firebase 数据库中创建了一个节点。现在我想用swift删除它。如何获得对这个自动生成号码的引用?我正在考虑使用此代码:
func deleteAction(at indexPath : IndexPath) -> UIContextualAction {
let action = UIContextualAction(style: .destructive, title: "Delete") { (action, view, completion) in
let vinyl = self.vinyls[indexPath.row]
guard let userID = Auth.auth().currentUser?.uid else { fatalError() }
Database.database().reference().child("vinyls").child(userID).removeValue(completionBlock: { (error, _) in
<#code#>
})
}
}
谢谢
【问题讨论】: