-2

谁能帮助我并告诉我为什么我在第 2 行出现错误?
消息框还说:

SignIn 致命错误:在展开可选值 (lldb) 时意外发现 nil

@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{
4

1 回答 1

1

有 1 个字符串,两个 bool,两个 bool 都是!必须改变 isSignIn Bool 吗?解决了这个问题

var buttonTitlePressed: 字符串?var isSignIn: 布尔值?var isUser:布尔!

于 2016-03-21T21:34:05.297 回答