在Xcode中调试未捕获的异常 [英] Debugging uncaught exception in Xcode

查看:171
本文介绍了在Xcode中调试未捕获的异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力改善使用Xcode。我打开了AllExceptions断点。当我的应用程序崩溃时,我看到了这一点:

I'm trying to get better at using Xcode. I have the AllExceptions break point turned on. When my app crashes, I see this:

*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 1 beyond bounds [0 .. 0]'
*** First throw call stack:
(0xbb8052 0x209cd0a 0xba4db8 0x2255f2 0xc2439 0x12a5e0f 0x12a6589 0x146bfb1 0x147617c 0x12938e1 0x1290602 0x129b211 0x129b23f 0xc16a6 0x138a4c 0x138852 0x14d0e39 0x14d0143 0x14d13cf 0x14d3a31 0x14d398c 0x14cc3e7 0x1234812 0x1234ba2 0x121b384 0x120eaa9 0x28d3fa9 0xb8c1c5 0xaf1022 0xaef90a 0xaeedb4 0xaeeccb 0x28d2879 0x28d293e 0x120ca9b 0x265c 0x25c5)
terminate called throwing an exception(lldb) 

在LHS上,当我看到不同的线程时,我看不到任何真正有意义的东西。我看到一些CFRunLoop的东西,但我没有看到任何正常的方法名称,如UITableView委托/数据源方法或我自己的方法。当我的应用程序崩溃时,我想知道是否有更多信息可用的堆栈跟踪而不是十六进制的东西。我知道我可以在每个地方设置断点我正在访问数组我觉得我有问题,因为我基本上只是想尝试使用我们特定数据源的手风琴式的tableview,但我想知道是否有更快的速度通过查看Xcode中有用的东西。谢谢!

On the LHS, when I look at the different threads, I don't see anything that really makes sense. I see some CFRunLoop stuff, but I don't see any "normal" method names like UITableView delegate/datasource methods or my own methods. I was wondering if there was a more informative stack trace available instead of the hex stuff when my app crashes. I know I can set breakpoints at each place I'm accessing the array I think I have a problem with since I'm basically just trying to have an accordion-like tableview with our specific datasource, but I was wondering if there was a faster way by looking at something useful in Xcode. Thanks!

推荐答案

在Xcode中,


  1. 转到左侧窗格上的断点导航器。

  2. 点击底部的+。

  3. 选择添加例外断点...

  4. 选择默认选项并点击完成。

  1. go to Breakpoint navigator on the left pane.
  2. Click '+' at the bottom.
  3. Choose 'Add exception Breakpoint...'
  4. Let the default selections there and click 'Done'.

重新运行应用并查看如果执行在导致此异常的行停止。

Rerun the app and see if execution stops at the line which causing this exception.

这篇关于在Xcode中调试未捕获的异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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