在 Swift 中多次按下按钮
Pressing a button more than once in Swift
当我在应用程序中多次按下按钮时,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
}
}
FirebaseApp.configure() 需要在 application:didFinishLaunchingWithOptions: 函数上从 AppDelegate
崩溃可能是因为你调用了两次。
当我在应用程序中多次按下按钮时,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
}
}
FirebaseApp.configure() 需要在 application:didFinishLaunchingWithOptions: 函数上从 AppDelegate
崩溃可能是因为你调用了两次。