ios - NSMutableArray 索引 9223372036854775807 越界

标签 ios objective-c ios7

<分区>

我通过崩溃报告发现了这一点:

*** -[__NSArrayM objectAtIndex:]: index 9223372036854775807 beyond bounds [0 .. 8]
CoreFoundation-[__NSArrayM removeObjectAtIndex:]

这是负责的代码:

[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]];
}

这个庞大的索引将如何以及在哪里发生?

最佳答案

我相信有问题的索引是 NSNotFound

您可能从“在数组中查找”操作的结果(或从其中返回的 NSRange 的位置)获取索引

关于ios - NSMutableArray 索引 9223372036854775807 越界,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22391911/

相关文章:

ios - UIPopoverController不断重新加载UIWebView

objective-c - dealloc : release then set to nil? 中的属性或简单地释放

iOS:在多个后台线程完成之前不要从函数返回

iphone - 将数组从 NSObject 传递到 View Controller

ios - 快速总结 Realm 对象数组中的属性

http - 将用户个人资料图片发布到 Twitter 时出现错误 131

ios - 在 MapView 中显示用户位置

ios - UIView 动画完成 block 未被调用

ios - App Store 审核指南 2.5.1 - 因 "Pointer Authentication API"而被拒绝

objective-c - Core Data什么时候自己保存托管对象上下文?