Asi Givati
Asi Givati

Reputation: 1475

Detect array with issue (Debug mode)

My app is crushing when i'm calling a few methods

I can see the error message and I understand what it say but I don't know how to detect the array with the problem by the message. I have lots of arrays in the project. how can I know from where the problem come from?

this is the message:

2014-12-16 15:07:01.830 myApp[2776:1237923] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array'
*** First throw call stack:
(0x2a3eae3f 0x37a98c8b 0x2a2ffc49 0x114c07 0x2d8e515d 0x2d8e3835 0x2d8df47d 0x2d885b37 0x2d2adccd 0x2d2a96b5 0x2d2a953d 0x2d2a8f21 0x2d2a8d25 0x2d2a2bfd 0x2a3b15cd 0x2a3aec8b 0x2a3af093 0x2a2fd621 0x2a2fd433 0x316ab0a9 0x2d8e7809 0x12fee5 0x38018aaf)
libc++abi.dylib: terminating with uncaught exception of type NSException

Upvotes: 2

Views: 1099

Answers (2)

Mehul Patel
Mehul Patel

Reputation: 23053

To handle All exceptions, From Xcode click on Show the Breakpoint Navigator

Click + button at bottom side and from pop up click on Add Exception Breakpoint.

enter image description here

This will add exception break points for application, try to run again and execution will stop if any runtime exception raised.

enter image description here

If this will not help, enable zombie environment for project, check out from this thread -

How to set exception breakpoint from Xcode

Upvotes: 4

Sarim Sidd
Sarim Sidd

Reputation: 2176

Enable Zombie Object in Xcode for better error tracing.

To enable

  • Press Command+Option+R
  • Under Diagnostic tab-> Memory Management
  • Check "Enable Zombie Object"

Hope this Helps

Upvotes: 1

Related Questions