如何让 Xcode4 在 NSAssert 失败时停止? [英] How to make Xcode4 stop at NSAssert failure?

查看:24
本文介绍了如何让 Xcode4 在 NSAssert 失败时停止?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,我的 Xcode4 不会在 NSAssert 失败时停止.我怎样才能让它再次在 NSAssert 失败时停止?

Currently, my Xcode4 does not stop at NSAssert failure. How can I make it stop at NSAssert failure again?

推荐答案

  1. 转到 XCode 4 断点导航器.
  2. 点击 + 按钮并选择添加符号断点"
  3. 将符号设置为-[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:]"
  4. 点击完成"

现在,只要 NSAssert 触发,您就会在调试器中停止.在我的测试中,它会转到最近的源代码,而不只是显示设置断点的程序集.

Now you will stop in the debugger as soon as NSAssert fires. In my testing, it goes to the nearest source code and doesn't just show you the assembly where you set the breakpoint.

更一般地说,您可以这样做:

More Generically, you could do this:

  1. 转到断点导航器.
  2. 单击 + 按钮并选择添加异常断点"
  3. 将异常设置为Objective-C"
  4. 将休息时间设置为投掷"
  5. 点击完成"

这可能或多或少有用,具体取决于您的代码.

This may be more or less useful depending on your code.

另请参阅添加异常断点"的 XCode 4 文档结果

See also the XCode 4 documentation result for "Adding an Exception Breakpoint"

这篇关于如何让 Xcode4 在 NSAssert 失败时停止?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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