我对这个问题进行了很多努力,所以我会提供答案以防其他人遇到问题
答案 0 :(得分:0)
swift似乎更新它的节点是通过"替换并添加" firebase网站的例子似乎没有用,所以我通过反复试验弄明白了
覆盖func viewDidLoad(){ super.viewDidLoad()
self.txtBankName.text = oBank.BankName;
self.txtBankType.text = oBank.BankType;
self.txtBankBalance.text = String(describing: oBank.BankBalance!)
fireBaseKey = oBank.fireBaseKey;
lblFireBaseKey.text = fireBaseKey;
refBanks = Database.database().reference().child("Bank")
}
func updateBankFirebase()
{
let key = oBank.fireBaseKey
let bankBalance:String? = self.txtBankBalance.text;
let updateBank = ["BankName":oBank.BankName!,"BankType":self.txtBankType.text!,"BankBalance":bankBalance,"id":key!]
refBanks.child(key!).setValue(updateBank)
lblFireBaseKey.text = "Record updated..."
};