Swift PrepareForSegue EXC_BREAKPOINT

时间:2015-02-12 06:46:59

标签: xcode swift ios7

我遇到运行时错误:线程1:EXC_BreakPoint(cod = EXC_I1386_BPT,子码= 0x0)

我没有在Xcode中设置任何断点。从调试器,错误是由PrepareForSegue停止一个线程“swift_dynamicCastClassUnconditional”

BarTableViewController1类

    @IBAction func solve_PressedBar(sender: AnyObject) {

        self.performSegueWithIdentifier("SolveBar", sender: sender)

    }

    override func prepareForSegue ( segue: UIStoryboardSegue, sender: AnyObject!) {
        if (segue.identifier == "SolveBar") {
            var svcBar = segue.destinationViewController as BarTableViewController2

            for items in textField1 {
                length.append((items as NSString).floatValue)
            }

            for items in textField2 {
                youngMod.append((items as NSString).floatValue)
            }

            for items in textField3 {
                diameter.append((items as NSString).floatValue)
            }

            for items in textField4 {
                forceBarWall.append((items as NSString).floatValue)
            }

            self.funcForceBarWall()

            println("variables are from TableViewController2")
            println(self.length)
            println(self.youngMod)
            println(self.forceBarWall)
            println(self.diameter)

            svcBar.length2 = self.length
            svcBar.youngMod2 = self.youngMod
            svcBar.diamter2 = self.diameter
            svcBar.forceBarWall2 = self.forceBarWall

            println("testing from bar viewcontroller1")
        }
    }
}

1 个答案:

答案 0 :(得分:0)

我先看看这里:

var svcBar = segue.destinationViewController as BarTableViewController2

检查故事板并确保segue确实连接到BarTableViewController2项目。有时在拖动时,我会偶然将segue连接到其他东西。