performSegue:缺少参数“发送者”的参数

时间:2018-12-02 15:55:09

标签: swift xcode segue

有人知道为什么我的函数出现此错误吗?我在网上搜索,但没有人找到解决方案。在我的标识符行“ goToHome”中,Xcode向我显示了错误。如果有人可以帮助我,我将非常感谢。

@IBAction func signInButtonTrapped(_ sender: UIButton) { if let email = emailTextField.text, let passwort =   passwortTextField.text { if isSignIn {
    Auth.auth().signIn(withEmail: email, password: passwort) {   (user, error) in

    if let u = user {
        self.performSegue(withIdentifier: "goToHome", sender: self)
    } else {         //Error

1 个答案:

答案 0 :(得分:0)

您的问题self.performSegue(withIdentifier: "goToHome", sender: self)可能是从后台线程调用的。所有UI操作必须在主线程的队列上执行。您应该像这样在闭包内部调用主线程-

DispatchQueue.main.async {
    if let u = user {
        self.performSegue(withIdentifier: "goToHome", sender: self)
    } else { }
}