我有一个错误,当我删除我的用户信息时,不会调用完成块。我已经看到问题涉及完成块的答案,但我的问题仍然存在。我能够成功地从我的数据库中删除用户,并在删除之前重新验证用户。这是我的代码:
let ref = FIRDatabase.database().reference()
let deleteUserFromCurrentSchool = ref.child("schoolOrWorkAddress").child(self.currentUser.schoolOrWorkAddress).child(self.currentUser.id)
deleteUserFromCurrentSchool.removeValue()
let deleteUserFromUserNode = ref.child("users").child(self.currentUser.id)
deleteUserFromUserNode.removeValue()
let currentUserToDelete = FIRAuth.auth()?.currentUser
if currentUserToDelete != nil {
currentUserToDelete?.delete(completion: { (error) in
if error != nil {
ProgressHUD.showError(Constants.ProgressMessages.errorMessage)
} else {
ProgressHUD.showSuccess("Account Deleted. Thanks for using ZipShare!")
let vc = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "Home")
self.present(vc, animated: true, completion: nil)
}
})
}
正如我所说的那样,用户正在被删除。但是,不会调用完成块之后的代码。我不知道为什么,任何帮助都会受到赞赏!
PS:这里要清楚的是没有被调用的代码:
if error != nil {
ProgressHUD.showError(Constants.ProgressMessages.errorMessage)
} else {
ProgressHUD.showSuccess("Account Deleted. Thanks for using ZipShare!")
let vc = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "Home")
self.present(vc, animated: true, completion: nil)
}