Reputation: 47
An error is occurring in my Swift app for iOS 8 in Xcode 6.4.
fatal error: unexpectedly found nil while unwrapping an Optional value
(lldb)
Gyazo Screenshot: http://i.gyazo.com/6bd9207655763cf941b44c8049f88549.png
I've been trying to fix this error for almost 2 hours now!
Please help me.
Thanks,
Jamie Mathieson
Upvotes: 0
Views: 129
Reputation: 11
Well, that's a simple problem to solve.. UsernameTextField.text and PasswordTextField.text can be blank, so you can't put ! after it.. You have to do something like this:
if UsernameTextField.text != nil && PasswordTextField != nil {
user.username = UsernameTextField.text
user.password = PasswordTextField.text
}
Hope this helps..
Upvotes: 1