如何快速访问Firebase的唯一ID?我已经尝试了该论坛拥有的几乎所有内容,我试图快速删除表单元格中的特定节点:
我尝试从“用户”电子邮件创建引用,并在字典中检索ID,但是当我尝试从“ indexPath”引用它时,它将返回ID。
我尝试了一个类型为int,string,any的Array。那些对我大吼大叫。
我包括一些示例代码:
func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
var currentEmail = Auth.auth().currentUser?.email as String?
if(editingStyle == .delete) {
let ref = Database.database().reference()
ref.child(currentEmail!).observe(.value, with: { snapshot in
if !snapshot.exists() {return} //may want to add better error handling here.
let info = snapshot.value as! NSDictionary
let reff = info.index(ofAccessibilityElement: indexPath)
print("info keys are:", reff)
})
}
最佳答案
您是否尝试了snapshot.key?例:
self.uid =快照。密钥
关于swift - 如何快速检索唯一ID以将其删除(Firebase),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/58810182/