gpt4 book ai didi

ios - 如何制作密码确认器 swift 3

转载 作者:行者123 更新时间:2023-11-30 12:22:27 24 4
gpt4 key购买 nike

我有 4 个文本字段,其中 2 个是密码和确认密码。在进入登录屏幕之前,我需要检查它们是否相同或其中包含文本。这是我的代码:

func registerButtonTapped() {
var a = false
var b = false

if passwordFieldR.text! == confirmFieldR.text! {
a = true
} else {
nonMatchingPasswords.text = "Passwords Do Not Match"
}

if(passwordFieldR.text! == "" || confirmFieldR.text! == "") {
nonMatchingPasswords.text = "Password Field is empty"
} else {
b = true
}

if a == true && b == true {
func registerButtonTwo(_ sender: Any) {
self.performSegue(withIdentifier: "registertologin", sender: self)
}
}
}

应用程序崩溃并在控制台中显示此错误消息:

2017-06-19 21:29:20.926579+1200 Altitude[1655:588172] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
2017-06-19 21:29:20.927965+1200 Altitude[1655:588172] [MC] Reading from public effective user settings.
2017-06-19 21:29:30.784007+1200 Altitude[1655:588172] -[Altitude.secondscreenviewcontroller registerButtonTwo:]: unrecognized selector sent to instance 0x100d085d0
2017-06-19 21:29:30.784671+1200 Altitude[1655:588172] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Altitude.secondscreenviewcontroller registerButtonTwo:]: unrecognized selector sent to instance 0x100d085d0'
*** First throw call stack:
(0x18add2fd8 0x189834538 0x18add9ef4 0x18add6f4c 0x18acd2d2c 0x190f370ec 0x190f3706c 0x190f215e0 0x190f36950 0x190f3646c 0x190f31804 0x190f02418 0x1916fbf64 0x1916f66c0 0x1916f6aec 0x18ad81424 0x18ad80d94 0x18ad7e9a0 0x18acaed94 0x18c718074 0x190f67130 0x1000e075c 0x189cbd59c)
libc++abi.dylib: terminating with uncaught exception of type NSException

发生了什么事以及如何解决这个问题?

最佳答案

我认为这对您有用(您可以将 5 个数字更改为您希望成为密码字符最少的任何数字)

if  ((passwordFieldR.text?.characters.count)! > 5) {


if passwordFieldR.text! == confirmFieldR.text! {


print("registertologin")

} else {

print("Password Does Not Match Confirm Password")


}

} else {

print("password Characters should be more Than 5")

}

关于ios - 如何制作密码确认器 swift 3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44626962/

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