My iOS app crashes as soon as I press something. As soon as I press the password textbox or anything else it crashes. Code below:
import UIKit
import FirebaseDatabase
class SecondRegisterViewController: UIViewController {
var ref: DatabaseReference!
@IBOutlet weak var UsernameText: UITextField!
@IBOutlet weak var PasswordText: UITextField!
@IBOutlet weak var ConfirmText: UITextField!
@IBOutlet weak var FirstNameText: UITextField!
@IBOutlet weak var MiddleNameText: UITextField!
@IBOutlet weak var LastNameText: UITextField!
@IBOutlet weak var EmailText: UITextField!
@IBOutlet weak var NextButton: UIButton!
@IBAction func NextButton(_ sender: Any) {
ref?.child("Usernames").childByAutoId().setValue(UsernameText.text)
ref?.child("Passwords").childByAutoId().setValue(PasswordText.text)
ref?.child("First Names").childByAutoId().setValue(FirstNameText.text)
ref?.child("Last Names").childByAutoId().setValue(LastNameText.text)
ref?.child("Middle Names").childByAutoId().setValue(MiddleNameText.text)
ref?.child("Emails").childByAutoId().setValue(EmailText.text)
}
override func viewDidLoad() {
super.viewDidLoad()
ref = Database.database().reference()
NextButton.isHidden = false
if UsernameText.text?.isEmpty == false && PasswordText.text?.isEmpty == false &&
ConfirmText.text?.isEmpty == false &&
FirstNameText.text?.isEmpty == false &&
MiddleNameText.text?.isEmpty == false &&
LastNameText.text?.isEmpty == false &&
EmailText.text?.isEmpty == false{
NextButton.isHidden = false
}
}
}
It also says:
libc++abi.dylib: terminating with the uncaught exception of type NSException
This is a big problem and I would be grateful for any help.
I fully connected all outlets and full console below:
2018-07-29 06:50:33.225228+0530 SchoolDrive[22497:4253058] -[SchoolDrive.SecondRegisterViewController UsernameText:]: unrecognized selector sent to instance 0x7ffc57c2e840
2018-07-29 06:50:33.321943+0530 SchoolDrive[22497:4253058] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[SchoolDrive.SecondRegisterViewController UsernameText:]: unrecognized selector sent to instance 0x7ffc57c2e840'
*** First throw call stack:
(
0 CoreFoundation 0x00000001036381e6 __exceptionPreprocess + 294
1 libobjc.A.dylib 0x0000000102ccd031 objc_exception_throw + 48
2 CoreFoundation 0x00000001036b9784 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 UIKit 0x0000000103ce36db -[UIResponder doesNotRecognizeSelector:] + 295
4 CoreFoundation 0x00000001035ba898 ___forwarding___ + 1432
5 CoreFoundation 0x00000001035ba278 _CF_forwarding_prep_0 + 120
6 UIKit 0x0000000103ab63e8 -[UIApplication sendAction:to:from:forEvent:] + 83
7 UIKit 0x0000000103c317a4 -[UIControl sendAction:to:forEvent:] + 67
8 UIKit 0x0000000103c31ac1 -[UIControl _sendActionsForEvents:withEvent:] + 450
9 UIKit 0x00000001047ca2a0 -[UITextField _resignFirstResponder] + 155
10 UIKit 0x0000000103ce30c8 -[UIResponder _finishResignFirstResponder] + 286
11 UIKit 0x00000001047c9ebf -[UITextField _finishResignFirstResponder] + 48
12 UIKit 0x0000000103ce3177 -[UIResponder resignFirstResponder] + 140
13 UIKit 0x00000001047c9d8f -[UITextField resignFirstResponder] + 135
14 UIKit 0x0000000103ce2df0 -[UIResponder becomeFirstResponder] + 655
15 UIKit 0x0000000103b6cb68 -[UIView(Hierarchy) becomeFirstResponder] + 145
16 UIKit 0x00000001047c8aff -[UITextField becomeFirstResponder] + 110
17 UIKit 0x0000000103dbf389 -[UIKeyboardImpl handleTabWithShift:beforePublicKeyCommands:] + 384
18 UIKit 0x0000000103db5cea -[UIKeyboardImpl handleKeyCommand:repeatOkay:beforePublicKeyCommands:] + 4884
19 UIKit 0x0000000103dd26ce -[UIKeyboardImpl handleKeyEvent:executionContext:] + 1166
20 UIKit 0x0000000104832bd3 -[UIKeyboardTaskEntry execute:] + 164
21 UIKit 0x00000001048313dd -[UIKeyboardTaskQueue continueExecutionOnMainThread] + 374
22 UIKit 0x0000000103dd21af -[UIKeyboardImpl handleKeyEvent:] + 210
23 CoreFoundation 0x00000001035bbccc __invoking___ + 140
24 CoreFoundation 0x00000001035bbb84 -[NSInvocation invoke] + 308
25 UIKit 0x00000001043f2cad -[UIRepeatedAction invoke] + 293
26 UIKit 0x00000001043f2ce3 -[UIRepeatedAction _preInvocationTimerFire] + 22
27 UIKit 0x0000000103ad1614 -[UIApplication _handleKeyUIEvent:] + 2050
28 UIKit 0x0000000103ce4cdb -[UIResponder _handleKeyUIEvent:] + 79
29 UIKit 0x0000000103ce4cdb -[UIResponder _handleKeyUIEvent:] + 79
30 UIKit 0x0000000103ce4cdb -[UIResponder _handleKeyUIEvent:] + 79
31 UIKit 0x0000000103ce4cdb -[UIResponder _handleKeyUIEvent:] + 79
32 UIKit 0x0000000103ce4cdb -[UIResponder _handleKeyUIEvent:] + 79
33 UIKit 0x0000000103ce4cdb -[UIResponder _handleKeyUIEvent:] + 79
34 UIKit 0x0000000103ce4cdb -[UIResponder _handleKeyUIEvent:] + 79
35 UIKit 0x0000000103ad0b3c -[UIApplication handleKeyUIEvent:] + 103
36 UIKit 0x0000000103ad0ab5 -[UIApplication handleKeyHIDEvent:] + 692
37 UIKit 0x0000000104410fa8 __dispatchPreprocessedEventFromEventQueue + 997
38 UIKit 0x00000001044142c4 __handleEventQueueInternal + 5949
39 CoreFoundation 0x00000001035dabb1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
40 CoreFoundation 0x00000001035bf4af __CFRunLoopDoSources0 + 271
41 CoreFoundation 0x00000001035bea6f __CFRunLoopRun + 1263
42 CoreFoundation 0x00000001035be30b CFRunLoopRunSpecific + 635
43 GraphicsServices 0x000000010988ea73 GSEventRunModal + 62
44 UIKit 0x0000000103ab5057 UIApplicationMain + 159
45 SchoolDrive 0x0000000100fce117 main + 55
46 libdyld.dylib 0x000000010679f955 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException