Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Finding out source of nsrangeexception

I have an NSRangeException error that does not occur all the time(especially when I am debugging). It comes up randomly, and I am unable to figure out where it is coming from. I have lots of array manipulation, so its difficult to eliminate it that way.

My question is whether I can get a clue , for example class and line number from the debugger output, for example what are the numbers 12109 and 707?:

2012-03-15 09:25:15.303 appname[12109:707] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayI objectAtIndex:]: index 2 beyond bounds [0 .. 0]'

Any pointers appreciated.

Edit: Remaining part of the log:

*** First throw call stack:
(0x33ff38bf 0x342431e5 0x33f4b275 0x1702d 0x37662331 0x3761b2b3 0x33f4d435 0x373b79eb 0x373b79a7 0x373b7985 0x373b76f5 0x3744de55 0x374e3e45 0x373aa99b 0x33fc7b4b 0x33fc5d87 0x33fc60e1 0x33f494dd 0x33f493a5 0x307cdfcd 0x373ca743 0x2325 0x22e4)
terminate called throwing an exception
like image 343
user542584 Avatar asked Mar 15 '12 08:03

user542584


1 Answers

Add an Exception breakpoint. This will stop on the line that raises the exception.

In the breakpoints navigator, click the plus in the bottom left, choose exception breakpoint, and all exceptions. You should have this on all projects really, it is invaluable. We'd have far fewer questions here, though!

like image 134
jrturton Avatar answered Oct 05 '22 04:10

jrturton