Swift PrepareForSegue EXC_BREAKPOINT

Posted

技术标签:

【中文标题】Swift PrepareForSegue EXC_BREAKPOINT【英文标题】: 【发布时间】:2015-02-12 06:46:58 【问题描述】:

我有一个运行时错误:线程 1:EXC_BreakPoint(cod=EXC_I1386_BPT,subcode=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】:

我先看看这里:

var svcBar = segue.destinationViewController as BarTableViewController2

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

【讨论】:

谢谢伙计。我已经尝试修复此错误 3 天.. 如此粗心的错误!

以上是关于Swift PrepareForSegue EXC_BREAKPOINT的主要内容,如果未能解决你的问题,请参考以下文章

将视图控制器分配给 prepareForSegue 中的变量时的 Swift EXC_BREAKPOINT

prepareForSegue 错误线程 1: EXC_BREAKPOINT (code=EXC_I386_BPT, subcode=0x0)

xcode6 beta7 prepareForSegue 抛出 EXC_BAD_ACCESS

xcode6 beta7 prepareForSegue 抛出 EXC_BAD_ACCESS

通过 prepareForSegue 传递 NSString - Swift

Swift:如何在 UICollectionViewCell 中使用“prepareForSegue”?