iOS中的NSInternalInconsistencyException posErrorMarker错误

hai*_*der 8 core-data objective-c-blocks ios6 uicollectionview

我收到一个无法确定性地重新创建的随机错误,这使得调试很麻烦.例外是

NSInternalInconsistencyException {Rows:0x1e5eb080.posErrorMarker == 1 + 1*0x1e5eb080.negError + 1*0x1fa51a40.marker 0x1f933020.negError == 274 + 1*0x1f933020.posErrorMarker + -1*0x1fb84100.marker 0x1fb8d610.negError == 274 + -1

> 
0CoreFoundation 0x32c1b3e7 + 162
1libobjc.A.dylib 0x3a916963 objc_exception_throw + 30
2CoreFoundation 0x32c1b307 + 106
3Foundation 0x335ce24f + 190
4Foundation 0x335d0871 + 60
5Foundation 0x335d19e9 + 624
6Foundation 0x335d9eab + 230
7UIKit 0x34e6211b + 162
8UIKit 0x34e67b9f + 26
9CoreFoundation 0x32b61acd CFArrayApplyFunction + 176
10UIKit 0x34e67bdf + 90
11CoreFoundation 0x32b61acd CFArrayApplyFunction + 176
12UIKit 0x34e67bdf + 90
13CoreFoundation 0x32b61acd CFArrayApplyFunction + 176
14UIKit 0x34e67bdf + 90
15CoreFoundation 0x32b61acd CFArrayApplyFunction + 176
16UIKit 0x34e67bdf + 90
17UIKit 0x34e67c6f + 26
18UIKit 0x34a2d769 + 732
19UIKit 0x34a78091 + 72
20UIKit 0x34e3b80d + 132
21UIKit 0x34e48e17 + 1830
22UIKit 0x34e46f37 + 7530
23MyApp 0x00093dd1 __32-[MyController requestStuff:]_block_invoke (MyController.m:123) + 298449
Run Code Online (Sandbox Code Playgroud)

MyController.m:123实际上只是调用我在MyController.m中定义的另一个名为requestLocalStuff的方法:

[self requestLocalStuff];
Run Code Online (Sandbox Code Playgroud)

这很奇怪,因为它似乎没有在requestLocalStuff中的特定行上抛出异常.

关于如何调用它的一些背景:

  • 这是从网络呼叫返回.我正在使用AFNetworking.
  • 进行网络调用的方法以块为参数,在网络调用成功返回后调用该块; 因此堆栈跟踪中的_block_invoke.
  • requestLocalStuff调用CoreData并最终使用insertItemsAtIndexPaths更新控制器中的UICollectionView.但是,当堆栈跟踪显示时,错误似乎不会从requestLocalStuff中抛出
  • 由于UICollectionView 中的错误,我被迫子类化UICollectionViewFlowLayout以捕获导致应用程序崩溃的异常.不确定是否可以参与.

我的UICollectionViewFlowLayout子类:

-(void)prepareForCollectionViewUpdates:(NSArray *)updateItems{
  @try {
  [super prepareForCollectionViewUpdates:updateItems];
  }
  @catch (NSException *exception) {
  DDLogError(@"Error in the layout: %@", exception);
  }
  @finally {

  }
}
Run Code Online (Sandbox Code Playgroud)

我在谷歌搜索posErrorMarker的解释无济于事.有没有人知道这里会发生什么?