I don\'t understand on how to debug this error message:
2011-02-01 20:45:56.151 NeMe[3206:207] *** Terminating app due to uncaught exception \'NSRangeExcepti
I was seeing this error, however, not as an exception but only in the Issue Navigator. The solution was to simply restart XCode, then the error was gone.
As Kevin Ballard said, this error is thrown when you ask for the element at index X that is beyond array bounds, in addition to looking for [array objectAtIndex: X]
, this error may be even caused from the modern syntax array[X]
It means that early in [NeighborMapViewController regionFromLocations]
you are attempting to index an NSMutableArray object. That array has zero elements in it -- it's empty. But you're apparently trying to access index 0, which would be the first element. Since there is no first element, you get an exception.
Probably the code that you expect to have executed to add items to the array has not yet executed, or you simply need to check the length of the array prior to trying to access the element at index 0. It's hard to say without knowing more about what you're doing.
gdb reports the offset as 65 bytes in to the function, so it's likely in one of the first few lines. You could probably manually inspect the code of the function to see, or set a breakpoint on the first line of the function and step through it.
You have an empty array. You tried to call [array objectAtIndex:0]
. 0 is beyond the bounds of an empty array (not surprising – anything is beyond the bounds for an empty array).