gpt4 book ai didi

ios - 在 Swift 中使用未解析的标识符 'SignUp'

转载 作者:行者123 更新时间:2023-11-30 14:05:40 26 4
gpt4 key购买 nike

下面是代码,希望有人能帮我解决使用未解析的标识符“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.
}
}

最佳答案

使函数声明和调用以小写 s 开头。

还值得注意的是,您应该为内容命名,以便清楚它是什么。

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


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

关于ios - 在 Swift 中使用未解析的标识符 'SignUp',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32442211/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com