I am sometimes seeing this exception in Crashlytics:
Fatal Exception: NSRangeException
*** -[__NSArrayM getObjects:range:]: range {0, 6294} extends beyond bounds [0 .. 6292]
-[NSMutableArray sortUsingSelector:]
-[NSArray sortedArrayFromRange:options:usingComparator:] + 284
I understand the message, but unfortunately I cannot find a reproducible sequence or root cause, though it seems to occur more often with larger data sets.
This is the related code that does the sorting, where the crash is occuring:
NSMutableArray *contacts = ...; // loaded from another method, in an NSOperation
NSArray *result = [contacts sortedArrayUsingComparator:^NSComparisonResult(Contact *obj1, Contact *obj2) {
return [obj1.fullName compare:obj2.fullName];
}];
Thanks for any suggestions!
EDIT: Here is a pastebin of the full exception from Crashlytics - http://pastebin.com/T2haqCWX