-2

Can anyone help me please and tell me why do I get error on line 2?
message box also says:

SignIn fatal error: unexpectedly found nil while unwrapping an Optional value (lldb)

@IBAction func done(sender: UIBarButtonItem) {

    if isSignIn == false {

        //Register code

        //Checking for empty boxes

        if self.username.text == "" || self.password.text == "" || self.riderDriverSelect.selectedSegmentIndex == -1 {

            //Red Border color for missing fields


            if self.username.text == "" {
                self.username.layer.borderColor = UIColor.redColor().CGColor
                self.username.layer.borderWidth = 1.0
            }

            if self.password.text == "" {
                self.password.layer.borderColor = UIColor.redColor().CGColor
                self.password.layer.borderWidth = 1.0
            }

            if self.riderDriverSelect.selectedSegmentIndex == -1 {
                self.riderDriverSelect.layer.borderColor = UIColor.redColor().CGColor
                self.riderDriverSelect.layer.borderWidth = 1.0

                self.showAlert("Missing field required", message: "Fill in or select missing fields in red")
            }


        }else{
Victor Sigler
  • 23,243
  • 14
  • 88
  • 105
Gediminas Tam
  • 25
  • 1
  • 8
  • I don't see any unwrapped optional in your code, can you see in our stack trace and see if the error is reflected before?. In what line exactly is your error? – Victor Sigler Mar 21 '16 at 21:03

1 Answers1

1

had 1 string two bool, and both of the bool were ! had to change isSignIn Bool? that fixed the problem

var buttonTitlePressed: String? var isSignIn: Bool? var isUser: Bool!

Gediminas Tam
  • 25
  • 1
  • 8