覆盖prepareForSegue函数时IBAction中的线程错误 [英] Thread error in IBAction while overriding prepareForSegue function

查看:56
本文介绍了覆盖prepareForSegue函数时IBAction中的线程错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的IBAction函数中出现线程错误Thread 1: Breakpoint 1.1.代码运行时没有错误,但是当我单击模拟器上的按钮时,模拟器崩溃并产生断点错误.受影响的代码是:

I'm getting a thread error Thread 1: Breakpoint 1.1 in my IBAction function. The code runs without error, but when I click the button on the simulator, the simulator crashes and produces the breakpoint error. The affected code is:

@IBAction override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject!) {
    if testoEsercizio.text == "Per iniziare premi la tv" {
        var viewController : SecondoSchermo = segue.destinationViewController as SecondoSchermo
        viewController.stringaponte = "SI buono"
    } else {
        var viewController : SecondoSchermo = segue.destinationViewController as SecondoSchermo
        viewController.stringaponte = "NON buono"
    }  
}

推荐答案

使用⌘ + 7在Xcode中打开断点编辑器.从那里可以看到断点处于打开状态(由深蓝色指示)或断点(具有浅蓝色).我高度怀疑您的方法中设置了断点.

Open the breakpoint editor in Xcode with ⌘ + 7. From there you can see the breakpoints that are on (as indicated by dark blue) or off (with light blue). I highly suspect that you have a breakpoint set in your method.

术语"Thread 1: Breakpoint 1.1"是调试器的断点内部名称(我想您是从绿色的文本栏中读取该名称吗?).这不一定意味着它是一个 线程错误,只是告诉您它在哪里停止.

The term Thread 1: Breakpoint 1.1 is the debugger's internal name for the breakpoint (I Assume you're reading this from the green bar of text?). It doesn't necessarily mean it is a threading error, it's just telling you where it stopped.

您可以按^ + ⌘ + Y键继续,或转到调试"菜单并选择其他选项. ⇧ + ⌘ + Y将弹出调试"区域和与调试菜单的操作相关的按钮栏.

You can press ^ + ⌘ + Y to Continue, or go to the Debug Menu and select other options. ⇧ + ⌘ + Y will bring up the Debug area and a bar of buttons which correlate to the Debug Menu's actions.

HTH

这篇关于覆盖prepareForSegue函数时IBAction中的线程错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆