【问题标题】:Pressing a button more than once in Swift在 Swift 中多次按下按钮
【发布时间】:2018-02-14 20:18:45
【问题描述】:

当我在我的应用中多次按下按钮时,我的 AppDelegate 中出现错误。

Thread 1: signal SIGABRT

这是我的按钮代码。如果您有任何问题,请务必告诉我!

//import Firebase
//import SVProgressHUD
//import UIKit

@IBAction func logInPressed(_ sender: AnyObject) {
    if emailTextField.text != "" || passwordTextField.text != "" {

        FirebaseApp.configure()
        Auth.auth().signIn(withEmail: emailTextField.text!, password: passwordTextField.text!) {
            (user, error) in
            SVProgressHUD.show()
            if error != nil {
                print(error!)
                self.incorrect.isHidden = false
                SVProgressHUD.dismiss()
            } else {
                self.incorrect.isHidden = true
                SVProgressHUD.dismiss()

                self.performSegue(withIdentifier: "Segue9", sender: self)
            }
        }
    } else {
        incorrect.isHidden = false
    }
}

【问题讨论】:

    标签: firebase swift4 xcode9 svprogresshud


    【解决方案1】:

    FirebaseApp.configure() 需要在 AppDelegateapplication:didFinishLaunchingWithOptions: 函数上调用

    崩溃可能是因为您调用了两次。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-02-20
      • 2016-05-20
      • 2016-10-02
      • 2016-05-07
      • 1970-01-01
      • 2014-08-17
      相关资源
      最近更新 更多