IBAction的错误消息

时间:2016-08-02 00:30:54

标签: swift xcode ibaction

import UIKit
import Firebase

class ViewController: UIViewController {


    @IBOutlet weak var emailField: UITextField!
    @IBOutlet weak var passwordField: UITextField!
    @IBOutlet weak var emailkeyboard: UITextField!
    @IBOutlet weak var passwordkeyboard: UITextField!
    @IBOutlet weak var myaccountButton: UIButton!
    @IBOutlet weak var welcomeLabel: UILabel!


    override func viewDidLoad() {
        super.viewDidLoad()
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    //Built in method
    override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
        self.view.endEditing(true)

    }

    @IBAction func buttonPressed(sender: UIButton) {
        self.emailkeyboard.resignFirstResponder()
        self.passwordkeyboard.resignFirstResponder()
    }

    @IBAction func myaccountbutton(sender: AnyObject) {
        FIRAuth.auth()?.signInWithEmail(self.emailField.text!, password: self.passwordField.text!, completion: { (user,error) in

    }

    @IBAction func createaccountButton(sender: AnyObject) {
        FIRAuth.auth()?.createUserWithEmail(emailField.text!, password: passwordField.text!) { (user, error) in
            if error == nil {
                print("User Created")

        if (FIRAuth.auth()?.currentUser) != nil
        {
            self.myaccountButton.alpha = 1.0
        }
        else
        {
            self.myaccountButton.alpha = 0.0
            self.welcomeLabel.text = ""
                    }
                }
            }
        }
    }
}

我无法弄清楚我之前问过)的位置,但我仍然卡住了。对不起家伙再问一遍。 我不确定上面的代码或IBAction本身是否有错误,所以我发布了所有可能有助于找到问题的代码。

1 个答案:

答案 0 :(得分:0)

signInWithEmail()函数调用缺少其结束括号,以及闭包参数的实际闭包。