NSMutableArray索引9223372036854775807超出范围

dai*_*dai 5 objective-c ios ios7

我通过崩溃报告找到了这个:

*** -[__NSArrayM objectAtIndex:]: index 9223372036854775807 beyond bounds [0 .. 8]
CoreFoundation-[__NSArrayM removeObjectAtIndex:]
Run Code Online (Sandbox Code Playgroud)

这是负责的代码:

[self someMethodwithCallback:^(NSMutableArray *stickerArray)
{
   _tableViewController.tableView beginUpdates];

   _layersArray = stickerArray;

   NSArray *reversed = [[_layersArray reverseObjectEnumerator] allObjects];

   _layersArray = [reversed mutableCopy];

  [_tableViewController.tableView insertRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:0 inSection:0]] withRowAnimation:UITableViewRowAnimationAutomatic];

  [_tableViewController.tableView endUpdates];

  [_tableViewController.tableView selectRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] animated:YES scrollPosition:UITableViewScrollPositionNone];

  [_delegate stickerSelectedAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]];
}
Run Code Online (Sandbox Code Playgroud)

这个巨大的指数将如何以及在何处发生?

nie*_*bot 13

我相信有问题的指数是NSNotFound.

您可能从"查找数组"操作的结果(或从一个返回的NSRange的位置)获取索引