2015-09-07 326 views
0

使用未解決的標識符「註冊」的下面是代碼,希望有人能幫助我解決問題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. 
} 
} 
+1

一般慣例是使用lowerCamelCase作爲屬性和方法來區分它們與UpperCamelCase類型,如結構體和類。 – 2015-09-07 16:23:35

回答

0

使函數的聲明,並呼籲啓動以小寫秒。

還值得注意的是你應該命名的東西,所以它很清楚它是什麼。

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


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

對不起。我不明白你的意思是'做功能宣言' – CrimZon

+0

@ArcadeMaestrex我已經編輯了我的答案,希望它有幫助。 – aamck