0
執行segue時,應用程序崩潰。我檢查是否有任何sigbrt錯誤,但沒有。我認爲這是日誌中的firebase分析。此錯誤來自日誌:preforming segue時的Firebase分析錯誤
以NSException類型的未捕獲異常終止。
代碼
@IBOutlet weak var email: UITextField!
@IBOutlet weak var password: UITextField!
@IBOutlet weak var adduser: UIButton!
@IBOutlet weak var errormessege: UILabel!
var databaseref = FIRDatabase.database().reference()
override func viewDidLoad() {
super.viewDidLoad()
password.isSecureTextEntry = true
adduser.isEnabled = false
}
@IBAction func didtapcancel(_ sender: Any) {
dismiss(animated: true, completion: nil)
}
@IBAction func didtapadd(_ sender: Any) {
adduser.isEnabled = false
FIRAuth.auth()?.createUser(withEmail: email.text!, password: password.text!, completion: {(user,error) in
if error != nil {
if error!._code == 17999 {
self.errormessege.text = "Invalid email address" }
else {
self.errormessege.text = error?.localizedDescription
}
}
else
{
FIRAuth.auth()?.signIn(withEmail: self.email.text!, password: self.password.text!, completion: {(user,error) in
if (error == nil) {
self.databaseref.child("users").child(user!.uid).child("email").setValue(self.email.text!)
self.performSegue(withIdentifier: "hi", sender: nil)
}
else {
self.errormessege.text = error?.localizedDescription
}
})
}
}
)
}
@IBAction func didtextchange(_ sender: Any) {
if((email.text?.characters.count)!>0){
adduser.isEnabled = true}
else{
adduser.isEnabled = false}
}
@IBAction func did4(_ sender: Any) {
if((password.text?.characters.count)!>0){
adduser.isEnabled = true}
else{
adduser.isEnabled = false}
}
您可以啓用火力地堡分析(添加-FIRAnalyticsDebugEnabled到您的應用程序在編輯計劃)調試模式,應用程序崩潰之前提供一些調試日誌?您的信息有限,因此很難判斷它是Firebase Analytics還是其他內容。 – adbitx