CrimZon
CrimZon

Reputation: 37

Missing Argument for parameter #1 in call error

I'm new in this website, and I already know that it helps me a LOT in coding, so thanks to the founder of this website and to the questioners and the answerers and everyone else :D

Still, one problem I have though. I have this 'Missing Argument for Parameter #1 in call' error. Its really annoying me, I'm trying to make an app, and for how much time I put into this app, I don't want to delete it. Please.

So here is the code:

class ViewController: UIViewController {


    @IBOutlet var UsernameTextField: UITextField!
    @IBOutlet var PasswordTextField: UITextField!
    @IBOutlet var EmailTextField: UITextField!
    @IBAction func LogIn(sender: AnyObject) {

    }

    @IBAction func SignUp(sender: AnyObject) {

       SignUp() //The error is here 

    }



    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.



    func SignUp(){
        var user = PFUser()
        user.username = UsernameTextField.text
        user.password = PasswordTextField.text
        user.email = EmailTextField.text
    }


    let user = PFUser()
    user.username = "Name:"
    user.password = "Pass:"
    user.email = "Email:"

    user.signUpInBackgroundWithBlock { (success: Bool, error: NSError?) -> Void in
    if error == nil {
       // Hooray! Let them use the app now.
       } else {
       // Examine the error object and inform the user.
       }
    }

}



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


}

Upvotes: 1

Views: 3314

Answers (1)

Robert
Robert

Reputation: 5859

You've got two functions with the same name, you should rename one of them!

First function:

@IBAction func SignUp(sender: AnyObject)

Second function:

func SignUp()

The reason you get the error is because the compiler is trying to use your first function rather than the second one, so the easiest way to fix it is to change the name of one of the functions.

Upvotes: 1

Related Questions