Reputation: 101
So, this is one of those crashes that only seem to happen with other people, and that I only found out about thanks to Bugsnag.
NSRangeException: -[__NSCFString characterAtIndex:]: Range or index out of bounds
So far so good, just your run-of-the-mill fencepost error or somesuch, right? Except the stacktrace looks like:
[appname]:0x0006a399 • [appname]
[appname]:0x00089435 • [appname]
[appname]:0x002629cb • _ZNSt3__16vectorIiNS_9allocatorIiEEE21__push_back_slow_pathIiEEvOT_
[appname]:0x001802b5 • _ZNSt3__16vectorIN7gmscore4base10reffed_ptrINS1_6vector16GLBaseLabelBatchEEENS_9allocatorIS6_EEE26__swap_out_circular_bufferERNS_14__split_bufferIS6_RS8_EE
[appname]:0x0019d115 • _ZNSt3__16vectorIN7gmscore6vector4text15GlyphQuadVertexENS_9allocatorIS4_EEE21__push_back_slow_pathIRKS4_EEvOT_
[appname]:0x0004eb33 • [appname]
[appname]:0x0004eae8 • [appname]
So I have absolutely no idea where this is coming from, but it seems not to be generated directly by a characterAtIndex:
call in my code (besides, there's only one such call in the whole app and it's well safeguarded). It seems to be a very core C function that's trying to read from a string where the index is out of bounds, but from this stacktrace I can't even start to figure out where that is. Any ideas?
Upvotes: 2
Views: 886
Reputation: 162712
Can you post a full crash report? There may be other clues.
Given the exception + stack trace, I suspect that there is stack corruption at play or that there is something goofy with the configuration of exception handlers that are causing the stack to be misreported (both of which I've seen before).
If you have a collection of crash reports, then check for commonalities between them;
all on the same model of device?
... same release of OS?
jailbroken?
... etc ...
Bugs like these are maddening to figure out, generally.
Upvotes: 2
Reputation: 4905
It may be that you are making a call to a system method that in turn calls to objectAtIndex:. I tend to always have an exception breakpoint on in the project while debugging, so it will then show you the calling code that caused the exception.
To create one:
Open the breakpoints pane.
Create a new breakpoint at the bottom of the pane
Choose "Add Exception Breakpoint..."
On the next screen leave the default options and click "Done"
Cause the crash again and see where it breaks you app.
Hope this helps!
Upvotes: 4