我的应用程序运行良好,然后当我决定注销并尝试创建新帐户时,该应用程序因出现sigabrt错误而崩溃,并显示以下消息:“文档引用中的段数必须为偶数,但用户的段数为1”控制台。我相信这可能是我的Firebase数据库或Firebase身份验证出现问题的原因,但是我在网上查看并没有找到解决此问题的任何方法。我正在使用Firebase云存储。
我尝试删除所有将文档添加到数据库的调用,但始终收到此错误,这使我相信这是Authentication进程的错误,但是,用户仍然在firebase的Authentication部分中注册。
Auth.auth().createUser(withEmail: email.text!, password: password.text!){ (user, error) in
if error == nil {
self.accessCodeExists(){ (accessCode) in
//Adds the access Code to the the document and sets it data
// self.db.collection("Access Codes").document(accessCode).setData([self.email.text!: ["Admin", self.fullNameField.text!]])
// //add the user to the users
// self.db.collection("users").document(self.email.text!).setData(["Full Name": self.fullNameField.text!, accessCode: "access code"])
//let the user know that their stuff has been completed and give them their accessCode
let alertController = UIAlertController(title: "Your access code is " + accessCode, message: "Give those access codes to your employees or whoever you want to add to the server so they can join your server", preferredStyle: .alert)
let defaultAction = UIAlertAction(title: "Ok", style: .cancel
, handler: nil)
alertController.addAction(defaultAction)
//perform the segue to the home screen
self.performSegue(withIdentifier: "signupToHome", sender: self)
self.present(alertController, animated: true, completion: nil)
}
} else{
let alertController = UIAlertController(title: "Error", message: error?.localizedDescription, preferredStyle: .alert)
let defaultAction = UIAlertAction(title: "OK", style: .cancel, handler: nil)
alertController.addAction(defaultAction)
self.present(alertController, animated: true, completion: nil)
}
}
这是我收到的确切错误消息,“由于未捕获的异常'FIRInvalidArgumentException',正在终止应用程序,原因:'无效的文档引用。文档引用必须具有偶数个段,但用户具有1''