2016-08-02 20 views
-1
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本身的錯誤,所以我已經發布了所有的代碼,也許這將有助於找到問題。IBAction的錯誤消息

+0

它要求IBAction func createaccountButton旁邊的')'它也說只有實例方法可以聲明@IBAction –

回答

0

signInWithEmail()函數調用缺少其結尾圓括號以及閉包參數的實際閉包。