iOS how to debug crashes without a stack trace like : [__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array?

拟墨画扇 提交于 2019-12-18 13:16:22

问题


I'm trying to dismiss a modal view controller and am getting the following error:

* Terminating app due to uncaught exception 'NSRangeException', reason: '* -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array'

At one point I spent 4 hours trying to debug such error. Can anyone tell me if there's a way to look at stack traces for such errors to understand which object caused the incorrect access?

Thank you!


回答1:


In Xcode 4 you can set an exception breakpoint in the breakpoint editor. Every time an exception is thrown (or caught depending on how you set it up), your application will pause on the line that threw the exception.




回答2:


if you are running in the debugger, then absolutely you should be able to see the actual line that the exception is being thrown on.

add an exception breakpoint by clicking the breakpoints tab at the top of the left pane, then click the plus sign at the lower left. Add an exception breakpoint.



来源:https://stackoverflow.com/questions/8569033/ios-how-to-debug-crashes-without-a-stack-trace-like-nsarraym-objectatindex

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!