在segue期间使用当前模态的sigabrt错误

时间:2017-03-25 22:27:17

标签: ios swift segue

当我运行我的应用程序时,注册过程正常工作并在firebase中创建一个用户 但是当进入标签栏控制器使用当前模态以预先形成segue时,出现sigabrt错误,并且没有描述错误的空白。

导入UIKit 导入Firebase 导入FirebaseDatabase

class signupViewController:UIViewController {

@IBOutlet weak var email: UITextField!
@IBOutlet weak var password: UITextField!
@IBOutlet weak var signup: UIButton!
@IBOutlet weak var cancel: UIButton!

var databaseref = FIRDatabase.database().reference()


override func viewDidLoad() {
    super.viewDidLoad()
    password.secureTextEntry = true
  //  signup.enabled = true
}

@IBAction func didtapcancel(sender: AnyObject) {
    dismissViewControllerAnimated(true, completion: nil)

}

@IBAction func signuptaped(sender: AnyObject) {

   //     signup.enabled=true
        FIRAuth.auth()?.createUserWithEmail(email.text!, password: password.text!, completion: {(user,error) in

            if error != nil {
                if error!.code == 17999 {

                    let alert = UIAlertController(title: "error 17999", message: "ohh", preferredStyle: UIAlertControllerStyle.Alert)
                    alert.addAction(UIAlertAction(title: "click", style: UIAlertActionStyle.Default, handler: nil))
                    self.presentViewController(alert, animated: true, completion: nil)
                }
                else {
                    print(error?.localizedDescription)

                }
            }

            else
            {
                FIRAuth.auth()?.signInWithEmail(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.performSegueWithIdentifier("tabbar", sender: sender)

                       // let alert = UIAlertController(title: "error ", message: "tt", preferredStyle: UIAlertControllerStyle.Alert)
                        //alert.addAction(UIAlertAction(title: "click", style: UIAlertActionStyle.Default, handler: nil))
                      //  self.presentViewController(alert, animated: true, completion: nil)
                    }
                })
            }


            }
        )}

}

0 个答案:

没有答案