gpt4 book ai didi

ios - 未知的选择器问题

转载 作者:行者123 更新时间:2023-11-28 06:37:33 25 4
gpt4 key购买 nike

我正在尝试创建一个注册页面,人们可以在其中输入电子邮件和所需密码等信息,完成后我想切换到下一个 View Controller ,但是,我收到以下错误

[StudyBuddy.SignUpViewController signUpButton:]: unrecognized selector sent to instance 0x7fac5e061b80'

注册 View Controller

import UIKit
import Firebase
import CoreData
import CoreLocation

class SignUpViewController: UIViewController {
@IBOutlet weak var emailField: UITextField!
@IBOutlet weak var passwordField: UITextField!
@IBOutlet weak var confirmPasswordField: UITextField!

override func viewDidLoad() {
super.viewDidLoad()
if let user = FIRAuth.auth()?.currentUser {



}
// Do any additional setup after loading the view.
}

override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func signupButton(sender: AnyObject)
{
if self.emailField.text == "" || self.passwordField.text == "" {

let alertController = UIAlertController(title: "Oops!", message: "Please enter a valid username and password", preferredStyle: .Alert)
let defaultAction = UIAlertAction(title: "Ok", style: .Cancel, handler: nil)
self.presentViewController(alertController, animated: true, completion: nil)

}

else if self.confirmPasswordField.text != self.passwordField.text {

let passwordAlert = UIAlertController(title: "Oops!", message: "Passwords do not match", preferredStyle: .Alert)
let passwordAction = UIAlertAction(title: "Ok", style: .Cancel, handler: nil)

self.presentViewController(passwordAlert, animated: true, completion: nil)
}

else {

FIRAuth.auth()?.createUserWithEmail(emailField.text!, password: passwordField.text!, completion: {(user, error) in

if error == nil {
self.performSegueWithIdentifier("goToSignUp", sender: sender)

}
else {
let createAlert = UIAlertController(title: "There was a problem", message: "There was a problem creating your account, please check the information you provided and try again", preferredStyle: .Alert)
let createAction = UIAlertAction(title: "Ok", style: .Cancel, handler: nil)
self.presentViewController(createAlert, animated: true, completion: nil)
}

})
}


}

最佳答案

您需要更改您的 signupButton 方法声明为 signUpButton 因为在您的声明中 uup > 您需要使用 Up 更改它,因为方法名称和属性名称区分大小写,或者使用此 signupButton 更改为选择器为按钮添加目标。

关于ios - 未知的选择器问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38782610/

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