I'm getting a random error that can't be deterministically recreated, which makes it a pain to debug. The exception is
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
MyController.m:123 is actually just a call to another method method I've defined in MyController.m named requestLocalStuff:
[self requestLocalStuff];
which is strange because it doesn't seem to be throwing the exception on a particular line within requestLocalStuff.
Some context on the how this is being called:
- This is on a return from a network call. I am using AFNetworking.
- The method making the network call takes a block as a parameter and calls that block after the network call successfully returns; hence the _block_invoke in the stack trace.
- requestLocalStuff makes calls to CoreData and eventually updates the UICollectionView in the controller using insertItemsAtIndexPaths. But as the stack trace shows, the error doesn't appear to be thrown from within requestLocalStuff
- Due to bugs within UICollectionView, I was forced to subclass UICollectionViewFlowLayout to catch an exception that was crashing the app. Not sure if that can be involved.
My UICollectionViewFlowLayout subclass:
-(void)prepareForCollectionViewUpdates:(NSArray *)updateItems{
@try {
[super prepareForCollectionViewUpdates:updateItems];
}
@catch (NSException *exception) {
DDLogError(@"Error in the layout: %@", exception);
}
@finally {
}
}
I've searched Google for an explanation of posErrorMarker to no avail. Does anyone have a clue of what could be going on here?