调用

时间:2016-05-10 09:01:43

标签: ios swift viewcontroller

我总是收到此错误,我不知道还有什么要输入。

你们知道发生了什么吗?

@IBAction func loginAction(sender: AnyObject)
{
    let email = self.emailTextField.text
    let password = self.passwordTextField.text

    if email != "" && password != ""
    {
        FIREBASE_REF.authUser(email, password: password, withCompletionBlock: { (error, authData) -> Void in

            if error == nil
            {
                NSUserDefaults.standardUserDefaults().setValue(authData.uid, forKey: "uid")

                print("Logged in")
                self.logoutButton.hidden = false
                self.performSegueWithIdentifier(String, sender: AnyObject?)
                self.presentViewController(HomeViewController, animated: true, completion: nil)
            }
            else
            {
              print(error)
            }


        })
    }
    else
    {
        let alert = UIAlertController(title: "Error", message: "Enter Email and Password", preferredStyle: .Alert)

        let action = UIAlertAction(title: "OK", style: .Default, handler: nil)

        alert.addAction(action)

        self.presentViewController(alert, animated: true, completion: nil)
    }
}

@IBAction func logoutAction(sender: AnyObject)
{
    CURRENT_USER?.unauth()

    NSUserDefaults.standardUserDefaults().setValue(nil, forKey: "uid")
    self.logoutButton.hidden = true
} 
}

错误在

self.presentViewVontroller(HomeViewController ...

我已经在故事板中创建了一个Segue。

1 个答案:

答案 0 :(得分:0)

如果您创建了一个Segue。首先选择Segue的segue和set identifier。

然后像这样执行segue

self.performSegueWithIdentifier(identifier,sender:nil)

无需写这一行

self.presentViewController(HomeViewController,animated:true,completion:nil)