使用未解決的標識符「註冊」的下面是代碼,希望有人能幫助我解決問題Use of unresolved identifier '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.
}
}
一般慣例是使用lowerCamelCase作爲屬性和方法來區分它們與UpperCamelCase類型,如結構體和類。 – 2015-09-07 16:23:35