我有4個文本字段,其中2個是密碼並確認密碼。在進入登錄屏幕之前,我需要檢查它們是否相同或是否有文本。我的繼承人代碼:如何使密碼快速確認3
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
這是怎麼回事,我該如何解決這一問題?
你爲什麼用另一種方法聲明'FUNC registerButtonTwo(...'在哪裏你將目標選擇器添加到按鈕的代碼? –
@ defence2000x實際上不應該導致崩潰。 –