在Swift中使用未解析的标识符“SignUp”

时间:2023-02-04 06:31:33

Below is the code, hope anyone can help me solve the Use of unresolved identifier 'SignUp' problem:

下面是代码,希望任何人都可以帮我解决使用未解析的标识符'SignUp'的问题:

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

@IBAction func Signup(sender: AnyObject) {
   SignUp() //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.
}
}

1 个解决方案

#1


0  

Make the function declaration and call start with a lower case s.

使用小写s进行函数声明和调用start。

It's also worth noting you should name stuff so it's clear what is it.

同样值得注意的是你应该说出一些东西,所以很清楚它是什么。

@IBAction func signUpButton(sender: AnyObject) {
   signUp() // Calling signUp function here that is declared below.
}


func signUp(){
    // Do sign up stuff.
}

#1


0  

Make the function declaration and call start with a lower case s.

使用小写s进行函数声明和调用start。

It's also worth noting you should name stuff so it's clear what is it.

同样值得注意的是你应该说出一些东西,所以很清楚它是什么。

@IBAction func signUpButton(sender: AnyObject) {
   signUp() // Calling signUp function here that is declared below.
}


func signUp(){
    // Do sign up stuff.
}