Crashlytics reported a crash in my app, and I have no idea of what is happening.
Here is the stacktrace:
Thread : Fatal Exception: NSInternalInconsistencyException
0 CoreFoundation 0x30080e83 __exceptionPreprocess + 130
1 libobjc.A.dylib 0x3a3dd6c7 objc_exception_throw + 38
2 CoreData 0x2fdcf941 -[NSSQLiteStatement cachedSQLiteStatement]
3 CoreData 0x2fdcf18d -[NSSQLiteConnection prepareSQLStatement:] + 52
4 CoreData 0x2fde8edf -[NSSQLChannel selectRowsWithCachedStatement:] + 58
5 CoreData 0x2fea8e1f newFetchedRowsForFetchPlan_MT + 910
6 CoreData 0x2fde8949 -[NSSQLCore fetchRowForObjectID:] + 1180
7 CoreData 0x2fde8311 -[NSSQLCore newValuesForObjectWithID:withContext:error:] + 256
8 CoreData 0x2fde762b _PFFaultHandlerLookupRow + 398
9 CoreData 0x2fde7193 _PF_FulfillDeferredFault + 218
10 CoreData 0x2fdf6449 _PF_ManagedObject_WillChangeValueForKeyIndex + 68
11 CoreData 0x2fdf636b _sharedIMPL_setvfk_core + 110
12 CoreData 0x2fe1995d _PF_Handler_Public_SetProperty + 92
13 CoreData 0x2fe1e2a9 -[NSManagedObject setValue:forKey:] + 124
14 Application 0x0004dc45 -[DateFormatter storeValue:error:] (DateFormatter.m:65)
15 Application 0x0004ee17 -[Formatter storeValue:inObject:] (Formatter.m:176)
16 Application 0x0002b5c5 -[NSManagedObject(App) setValuesForKeysWithReceivedDictionary:] (NSManagedObject+App.m:320)
17 Application 0x0002b8f3 -[NSManagedObject(App) setValuesForKeysWithReceivedDictionary:] (NSManagedObject+App.m:377)
18 Application 0x0006352d -[ODataGetOperation processResult:] (ODataGetOperation.m:220)
19 Application 0x0004420b -[ODataOperation connectionDidFinishLoading:] (ODataOperation.m:741)
20 Foundation 0x309bb47f __65-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]_block_invoke + 54
21 Foundation 0x309bb3c1 -[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:] + 204
22 Foundation 0x309bb2dd -[NSURLConnectionInternal _withActiveConnectionAndDelegate:] + 60
23 CFNetwork 0x2fceaf8f ___ZN27URLConnectionClient_Classic26_delegate_didFinishLoadingEU13block_pointerFvvE_block_invoke + 74
24 CFNetwork 0x2fce9b8f ___ZN27URLConnectionClient_Classic18_withDelegateAsyncEPKcU13block_pointerFvP16_CFURLConnectionPK33CFURLConnectionClientCurrent_VMaxE_block_invoke_2 + 54
25 CFNetwork 0x2fd1b337 ___ZNK17CoreSchedulingSet13_performAsyncEPKcU13block_pointerFvvE_block_invoke + 18
26 CoreFoundation 0x2ffb3ea1 CFArrayApplyFunction + 36
27 CFNetwork 0x2fc81e05 RunloopBlockContext::perform() + 164
28 CFNetwork 0x2fc81cd5 MultiplexerSource::perform() + 220
29 CFNetwork 0x2fc81b65 MultiplexerSource::_perform(void*) + 48
30 CoreFoundation 0x3004bf1f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14
31 CoreFoundation 0x3004b3e7 __CFRunLoopDoSources0 + 206
32 CoreFoundation 0x30049bd7 __CFRunLoopRun + 630
33 CoreFoundation 0x2ffb4471 CFRunLoopRunSpecific + 524
34 CoreFoundation 0x2ffb4253 CFRunLoopRunInMode + 106
35 Foundation 0x309a2697 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 254
36 Application 0x00043b4b -[ODataOperation send] (ODataOperation.m:548)
37 Application 0x0004277f -[ODataOperation operationWillStartPreparingData] (ODataOperation.m:131)
38 Foundation 0x30a5396d __NSOQSchedule_f + 60
39 libdispatch.dylib 0x3a8c64b7 _dispatch_async_redirect_invoke + 110
40 libdispatch.dylib 0x3a8c77d9 _dispatch_root_queue_drain + 224
41 libdispatch.dylib 0x3a8c79c5 _dispatch_worker_thread2 + 56
42 libsystem_pthread.dylib 0x3a9f1dff _pthread_wqthread + 298
43 libsystem_pthread.dylib 0x3a9f1cc4 start_wqthread + 8
And there is the last method that calls setValue:forKey: in an NSManagedObject subclass
- (BOOL)storeValue:(void *)theValue error:(NSError **)theError
{
NSString * value = (__bridge NSString *)theValue;
NSString * errorMessage = nil;
if (![value length] && !isOptional)
errorMessage = [NSString stringWithFormat: NSLocalizedString(#"Value cannot be nil or empty (Date) for field %#", #""), varName];
else
{
NSDate * date = nil;
if ([value length])
{
date = [NSDate dateWithISO8601: value];
if (!date)
errorMessage = [NSString stringWithFormat: NSLocalizedString(#"Invalid date %# for field %#", #""), theValue, varName];
}
if (IvarAddress)
*((__strong NSDate **) IvarAddress) = date;
else
[currentObject setValue: date forKey: varName];
}
if (errorMessage)
{
if (theError)
*theError = [NSError errorWithDomain: AppDomain code: NSFormattingError userInfo: #{ NSLocalizedDescriptionKey: errorMessage }];
#ifdef DEBUG
NSLog(#"Formatter error: %#", errorMessage);
#endif
return NO;
}
return YES;
}
I am completely open to any suggestion :)
Update : The key exists, and the value being set is an NSDate so it's an attribute of the NSManagedObject, not a relationship.
Update 2 :
I also have another crash with that method (stack trace is not exactly the same) :
Thread : Fatal Exception: NSInternalInconsistencyException
0 CoreFoundation 0x30080e83 __exceptionPreprocess + 130
1 libobjc.A.dylib 0x3a3dd6c7 objc_exception_throw + 38
2 CoreData 0x2fddfacb -[NSSQLCore _obtainOpenChannel] + 234
3 CoreData 0x2fea8ded newFetchedRowsForFetchPlan_MT + 860
4 CoreData 0x2fde8949 -[NSSQLCore fetchRowForObjectID:] + 1180
5 CoreData 0x2fde8311 -[NSSQLCore newValuesForObjectWithID:withContext:error:] + 256
6 CoreData 0x2fde762b _PFFaultHandlerLookupRow + 398
7 CoreData 0x2fde7193 _PF_FulfillDeferredFault + 218
8 CoreData 0x2fdf6449 _PF_ManagedObject_WillChangeValueForKeyIndex + 68
9 CoreData 0x2fdf636b _sharedIMPL_setvfk_core + 110
10 CoreData 0x2fe1995d _PF_Handler_Public_SetProperty + 92
11 CoreData 0x2fe1e2a9 -[NSManagedObject setValue:forKey:] + 124
12 Application 0x000fcc45 -[DateFormatter storeValue:error:] (DateFormatter.m:65)
13 Application 0x000fde17 -[Formatter storeValue:inObject:] (Formatter.m:176)
14 Application 0x000da5c5 -[NSManagedObject(App) setValuesForKeysWithReceivedDictionary:] (NSManagedObject+.m:320)
15 Application 0x000da8f3 -[NSManagedObject(App) setValuesForKeysWithReceivedDictionary:] (NSManagedObject+.m:377)
16 Application 0x0011252d -[ODataGetOperation processResult:] (ODataGetOperation.m:220)
17 Application 0x000f320b -[ODataOperation connectionDidFinishLoading:] (ODataOperation.m:741)
18 Foundation 0x309bb47f __65-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]_block_invoke + 54
19 Foundation 0x309bb3c1 -[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:] + 204
20 Foundation 0x309bb2dd -[NSURLConnectionInternal _withActiveConnectionAndDelegate:] + 60
The exception message also is different :
_obtainOpenChannel -- NSSQLCore 0x15ef3780: no database channel is available
But I think they are two related issues.
So I finally found the reasons which were all related to multithreading/concurrency issues. Basically updating the same objects on two threads at the same time..
The recently added core data debug flags (-com.apple.CoreData.ConcurrencyDebug 1) were used to figure out what was happening.
Related
I am experiencing a random crash in the following method:
- (void) addLineToVCard:(NSMutableString **)vCard forKey:(NSString *)key setValue:(NSString *)value
{
[*vCard appendString:[NSString stringWithFormat:#"%#:%#\r\n", key, value]];
}
and I'm calling this as:
NSMutableString* vCard = [NSMutableString string];
[self addLineToVCard:&vCard forKey:#"BEGIN" setValue:#"VCARD"];
[self addLineToVCard:&vCard forKey:#"VERSION" setValue:#"3.0"];
What am I doing wrong ? I could avoid this by passing a reference instead of a pointer object. But I would like to know the reason of crash here.
The crash log:
Crashed: com.apple.main-thread
0 libsystem_kernel.dylib 0x251e6c5c __pthread_kill + 8
1 libsystem_pthread.dylib 0x25290733 pthread_kill + 62
2 libsystem_c.dylib 0x2517b0ad abort + 108
3 libsystem_malloc.dylib 0x252180ad free_list_checksum_botch + 362
4 libsystem_malloc.dylib 0x252181db free_tiny_botch + 66
5 CoreFoundation 0x255332d3 __CFStringChangeSizeMultiple + 1838
6 CoreFoundation 0x2553178b __CFStringCheckAndReplace + 554
7 CoreFoundation 0x25491557 -[__NSCFString appendString:] + 26
8 iPhoneHandheldACT 0x1ae7cf -[ContactDetailViewController addLineToVCard:forKey:setValue:] (ContactDetailViewController.m:3009)
9 iPhoneHandheldACT 0x1ae515 -[ContactDetailViewController assembleVCard:] (ContactDetailViewController.m:2987)
10 iPhoneHandheldACT 0x1adcbd -[ContactDetailViewController shareVCard:] (ContactDetailViewController.m:2927)
11 iPhoneHandheldACT 0x1ad351 __47-[ContactDetailViewController btnSharePressed:]_block_invoke (ContactDetailViewController.m:2813)
12 UIKit 0x29f2cbd9 -[UIAlertController _fireOffActionOnTargetIfValidForAction:] + 68
13 UIKit 0x29f2d283 __85-[UIAlertController _dismissAnimated:triggeringAction:triggeredByPopoverDimmingView:]_block_invoke + 30
14 UIKit 0x29e237e3 -[UIPresentationController transitionDidFinish:] + 1230
15 UIKit 0x29e26a85 __56-[UIPresentationController runTransitionForCurrentState]_block_invoke_2 + 192
16 UIKit 0x29c04157 -[_UIViewControllerTransitionContext completeTransition:] + 90
17 UIKit 0x29b11ba5 -[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 540
18 UIKit 0x29b11685 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 204
19 UIKit 0x29b1157f -[UIViewAnimationState animationDidStop:finished:] + 78
20 QuartzCore 0x27b71689 CA::Layer::run_animation_callbacks(void*) + 252
21 libdispatch.dylib 0x250c980f _dispatch_client_callout + 22
22 libdispatch.dylib 0x250d7ba9 _dispatch_main_queue_callback_4CF$VARIANT$mp + 1524
23 CoreFoundation 0x2551db6d __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 8
24 CoreFoundation 0x2551c067 __CFRunLoopRun + 1574
25 CoreFoundation 0x2546b229 CFRunLoopRunSpecific + 520
26 CoreFoundation 0x2546b015 CFRunLoopRunInMode + 108
27 GraphicsServices 0x26a5bac9 GSEventRunModal + 160
28 UIKit 0x29b3f189 UIApplicationMain + 144
29 iPhoneHandheldACT 0xcbe21 main (main.m:16)
30 libdispatch.dylib 0x25113873 (Missing)
The pointer's pointer is not necessary, just like this:
- (void)addLineToVCard:(NSMutableString *)vCard forKey:(NSString *)key setValue:(NSString *)value
{
[vCard appendFormat:#"%#:%#\r\n", key, value];
}
Then use it:
NSMutableString* vCard = [NSMutableString string];
[self addLineToVCard:vCard forKey:#"BEGIN" setValue:#"VCARD"];
[self addLineToVCard:vCard forKey:#"VERSION" setValue:#"3.0"];
The result:
(lldb) po vCard
BEGIN:VCARD
VERSION:3.0
I'm seeing some of my users suffering this crash, though it's not reproducible, so I don't understand what it could mean. The stack trace is as follows:
Exception Type: SIGABRT
Exception Codes: #0 at 0x19968f1e0
Crashed Thread: 0
Application Specific Information:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Can't perform collection evaluate with non-collection object.'
Last Exception Backtrace:
0 CoreFoundation 0x0000000184154f5c __exceptionPreprocess + 124
1 libobjc.A.dylib 0x0000000198d47f80 objc_exception_throw + 52
2 Foundation 0x00000001850e92c8 -[NSSubqueryExpression expressionValueWithObject:context:] + 768
3 Foundation 0x0000000184fee964 -[NSFunctionExpression expressionValueWithObject:context:] + 188
4 Foundation 0x0000000184fee7d0 -[NSComparisonPredicate evaluateWithObject:substitutionVariables:] + 228
5 Foundation 0x00000001850e91a4 -[NSSubqueryExpression expressionValueWithObject:context:] + 476
6 Foundation 0x0000000184fee964 -[NSFunctionExpression expressionValueWithObject:context:] + 188
7 Foundation 0x0000000184fee7d0 -[NSComparisonPredicate evaluateWithObject:substitutionVariables:] + 228
8 Foundation 0x0000000184fee610 -[NSCompoundPredicateOperator evaluatePredicates:withObject:substitutionVariables:] + 388
9 Foundation 0x0000000184fee2b4 -[NSCompoundPredicate evaluateWithObject:substitutionVariables:] + 276
10 Foundation 0x0000000184fee55c -[NSCompoundPredicateOperator evaluatePredicates:withObject:substitutionVariables:] + 208
11 Foundation 0x0000000184fee2b4 -[NSCompoundPredicate evaluateWithObject:substitutionVariables:] + 276
12 CoreData 0x0000000183e2d30c -[NSFetchedResultsController(PrivateMethods) _objectInResults:] + 104
13 CoreData 0x0000000183e2c868 -[NSFetchedResultsController(PrivateMethods) _preprocessUpdatedObjects:insertsInfo:deletesInfo:updatesInfo:sectionsWithDeletes:newSectionNames:treatAsRefreshes:] + 552
14 CoreData 0x0000000183f25498 __77-[NSFetchedResultsController(PrivateMethods) _managedObjectContextDidChange:]_block_invoke + 1552
15 CoreData 0x0000000183e9bc20 developerSubmittedBlockToNSManagedObjectContextPerform + 192
16 CoreData 0x0000000183e9bae8 -[NSManagedObjectContext performBlockAndWait:] + 216
17 CoreData 0x0000000183e2bfe0 -[NSFetchedResultsController(PrivateMethods) _managedObjectContextDidChange:] + 112
18 CoreFoundation 0x00000001840fa6ac __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 16
19 CoreFoundation 0x00000001840f9ecc _CFXRegistrationPost + 392
20 CoreFoundation 0x00000001840f9c4c ___CFXNotificationPost_block_invoke + 56
21 CoreFoundation 0x000000018415f434 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1528
22 CoreFoundation 0x000000018403a834 _CFXNotificationPost + 364
23 Foundation 0x0000000184fa62fc -[NSNotificationCenter postNotificationName:object:userInfo:] + 64
24 CoreData 0x0000000183e2bf44 -[NSManagedObjectContext(_NSInternalNotificationHandling) _postObjectsDidChangeNotificationWithUserInfo:] + 76
25 CoreData 0x0000000183e2bed0 -[NSManagedObjectContext(_NSInternalChangeProcessing) _createAndPostChangeNotification:withDeletions:withUpdates:withRefreshes:] + 324
26 CoreData 0x0000000183e2a5c0 -[NSManagedObjectContext(_NSInternalChangeProcessing) _processRecentChanges:] + 2320
27 CoreData 0x0000000183ea4790 -[NSManagedObjectContext(_NestedContextSupport) _parentProcessSaveRequest:inContext:error:] + 1420
28 CoreData 0x0000000183ea50b8 __82-[NSManagedObjectContext(_NestedContextSupport) executeRequest:withContext:error:]_block_invoke + 344
29 CoreData 0x0000000183e972ec _perform + 320
30 CoreData 0x0000000183ea4e98 -[NSManagedObjectContext(_NestedContextSupport) executeRequest:withContext:error:] + 172
31 CoreData 0x0000000183e29514 -[NSManagedObjectContext save:] + 1160
32 CJournal 0x000000010019eee4 __41-[AddEditLogsWithStoryboard savePressed:]_block_invoke (AddEditLogsWithStoryboard.m:461)
33 CoreData 0x0000000183e9bc20 developerSubmittedBlockToNSManagedObjectContextPerform + 192
34 libdispatch.dylib 0x0000000199541770 _dispatch_client_callout + 12
35 libdispatch.dylib 0x000000019954c9c4 _dispatch_barrier_sync_f_invoke + 96
36 CoreData 0x0000000183e9bb08 -[NSManagedObjectContext performBlockAndWait:] + 248
37 CJournal 0x000000010019ee3c -[AddEditLogsWithStoryboard savePressed:] (AddEditLogsWithStoryboard.m:456)
38 UIKit 0x00000001896e23e4 -[UIApplication sendAction:to:from:forEvent:] + 96
39 UIKit 0x00000001898613f8 -[UIBarButtonItem(UIInternal) _sendAction:withEvent:] + 164
40 UIKit 0x00000001896e23e4 -[UIApplication sendAction:to:from:forEvent:] + 96
41 UIKit 0x00000001896e2360 -[UIControl sendAction:to:forEvent:] + 76
42 UIKit 0x00000001896cac88 -[UIControl _sendActionsForEvents:withEvent:] + 412
43 UIKit 0x00000001896cadd4 -[UIControl _sendActionsForEvents:withEvent:] + 744
44 UIKit 0x00000001896e1c78 -[UIControl touchesEnded:withEvent:] + 568
45 UIKit 0x00000001896e18a8 -[UIWindow _sendTouchesForEvent:] + 800
46 UIKit 0x00000001896daadc -[UIWindow sendEvent:] + 780
47 UIKit 0x00000001896aba2c -[UIApplication sendEvent:] + 244
48 UIKit 0x00000001896a9f18 _UIApplicationHandleEventQueue + 5344
49 CoreFoundation 0x000000018410c5a4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 20
50 CoreFoundation 0x000000018410c038 __CFRunLoopDoSources0 + 536
51 CoreFoundation 0x0000000184109d38 __CFRunLoopRun + 720
52 CoreFoundation 0x0000000184038dc0 CFRunLoopRunSpecific + 380
53 GraphicsServices 0x000000018f18c088 GSEventRunModal + 176
54 UIKit 0x0000000189712f60 UIApplicationMain + 200
55 CJournal 0x00000001000a73c4 main (main.m:17)
56 libdyld.dylib 0x00000001995728b8 start + 0
The code for when the "save" button is pressed is as follows:
[self.privateContext performBlockAndWait: ^{
NSError *error = nil;
self.existingLog.logSectionPeriod = nil;
if ([self.privateContext save:&error]){
[self.privateContext.parentContext performBlockAndWait:^{
NSError *parentError = nil;
if ([self.privateContext.parentContext save: &parentError]){
if (_delegate && [_delegate respondsToSelector:#selector(finishedCommonAddEditViewController:)])
[_delegate finishedCommonAddEditViewController:self];
else {
[self dismissViewControllerAnimated:YES completion:nil];
}
} else {
[self dismissViewControllerAnimated:YES completion:nil];
}
}];
} else {
[self dismissViewControllerAnimated:YES completion:nil];
}
}];
I can't really find any details about the exception message "Can't perform collection evaluate with non-collection object.". Anyone have any idea what this could be referring to?
Incidentally, the NSFetchedResultsController the stack is referring to is tied to a UITableView (not collection view). It doesn't set any predicates on it, so it's not like the predicate could be causing some issue.
Would love some opinions on what this could mean by analyzing the stack trace
==== Some more details ====
A Person has one-to-many relationship with Notes. A Note has one-to-one with Person. There are different NSFetchedResultsControllers that are listening to changes that can be affected, but it's not clear from the stack trace which one has the problem:
one with Notes entity with a 'person == self.notesPerson" predicate
(to show notes for this person only)
one with Notes entity without
a predicate, to show all the notes in one list.
one with Person entity without a predicate, but with 'notes' as part of the
"relationshipKeyPathsForPrefetching" array
The AddEditLogsWithStoryboard.m lines from the stack are the first and 7th line in the code snippet (performBlockAndWait) so they don't particularly help. What would have been useful is to know which collection property it is complaining about, or which of the NSFetchedResultsControllers
this is a stack trace from Flurry crash analytics. Any Idea what is going wrong in my Core Data table view implementation?
Full Stack Trace:
0 CoreFoundation 0x182d5c2d8 <redacted> + 132
1 libobjc.A.dylib 0x194a280e4 _objc_exception_throw + 60
2 CoreFoundation 0x182d5c218 -[NSException initWithCoder:] + 0
3 CoreData 0x182a1fbc8 -[_PFBatchFaultingArray objectAtIndex:] + 204
4 Appname 0x1000615e0 -[MasterViewController configureCell:atIndexPath:] + 124
5 Appname 0x1000613b8 -[MasterViewController controller:didChangeObject:atIndexPath:forChangeType:newIndexPath:] + 580
6 CoreData 0x182b22d60 <redacted> + 4124
7 CoreData 0x182aa1218 <redacted> + 200
8 CoreData 0x182aa10e4 -[NSManagedObjectContext performBlockAndWait:] + 256
9 CoreData 0x182a2c650 -[NSFetchedResultsController _managedObjectContextDidChange:] + 124
10 CoreFoundation 0x182d022c4 <redacted> + 20
11 CoreFoundation 0x182c3f450 __CFXNotificationPost + 2060
12 Foundation 0x183b6ea80 -[NSNotificationCenter postNotificationName:object:userInfo:] + 72
13 CoreData 0x182a2c5ac -[NSManagedObjectContext _postObjectsDidChangeNotificationWithUserInfo:] + 88
14 CoreData 0x182a2c52c -[NSManagedObjectContext _createAndPostChangeNotification:withDeletions:withUpdates:withRefreshes:] + 364
15 CoreData 0x182a2a9d4 -[NSManagedObjectContext _processRecentChanges:] + 2552
16 CoreData 0x182a22dc4 <redacted> + 384
17 CoreFoundation 0x182d142a4 <redacted> + 32
18 CoreFoundation 0x182d11230 <redacted> + 360
19 CoreFoundation 0x182d11610 <redacted> + 836
20 CoreFoundation 0x182c3d2d4 _CFRunLoopRunSpecific + 396
21 GraphicsServices 0x18c6936fc _GSEventRunModal + 168
22 UIKit 0x18783af40 _UIApplicationMain + 1488
23 Appname 0x1000d8d0c -[MainRowType .cxx_destruct] + 180
24 libdyld.dylib 0x1950d2a08 <redacted> + 4
Thanks for help !
you are getting some exception and you are using that exception to init with coder.
The object which contains info is nil and calling init with coder. so it will be good to check nil before proceeding object.
We can't say more without code ;)
I'm facing a strange CoreData related crash.
I'm using RestKit2 which has parent-child relationship between mainMOC and persistentMOC.
What seems to cause the crash (but hardly reproducable) is to store a new entity into CoreData (using mainMOC) and later try to retrieve object having relationship with previously stored entity (again using main MOC).
Stack trace doesn't contain any indication that it's coming from my code. Seems something fishy in merging the two contexts.
Crash happens on both iOS7 and iOS8 and on both Device and Simulator.
Does someone have experience with this?
2014-10-15 11:25:56.208 MyApplication[77240:14758953] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'The left hand side for an ALL or ANY operator must be either an NSArray or an NSSet.'
*** First throw call stack:
(
0 CoreFoundation 0x04e97df6 __exceptionPreprocess + 182
1 libobjc.A.dylib 0x04b21a97 objc_exception_throw + 44
2 Foundation 0x04179816 -[NSEqualityPredicateOperator performPrimitiveOperationUsingObject:andObject:] + 0
3 Foundation 0x04178b05 -[NSComparisonPredicate evaluateWithObject:substitutionVariables:] + 345
4 Foundation 0x0426e387 -[NSSubqueryExpression expressionValueWithObject:context:] + 627
5 Foundation 0x04178c8c -[NSFunctionExpression expressionValueWithObject:context:] + 231
6 Foundation 0x04178aa2 -[NSComparisonPredicate evaluateWithObject:substitutionVariables:] + 246
7 Foundation 0x041a9776 -[NSCompoundPredicateOperator evaluatePredicates:withObject:substitutionVariables:] + 254
8 Foundation 0x041a95ec -[NSCompoundPredicate evaluateWithObject:substitutionVariables:] + 292
9 Foundation 0x041a9776 -[NSCompoundPredicateOperator evaluatePredicates:withObject:substitutionVariables:] + 254
10 Foundation 0x041a95ec -[NSCompoundPredicate evaluateWithObject:substitutionVariables:] + 292
11 Foundation 0x041789a4 -[NSPredicate evaluateWithObject:] + 48
12 CoreData 0x048d836d -[NSFetchedResultsController(PrivateMethods) _objectInResults:] + 109
13 CoreData 0x048d9d10 -[NSFetchedResultsController(PrivateMethods) _preprocessUpdatedObjects:insertsInfo:deletesInfo:updatesInfo:sectionsWithDeletes:newSectionNames:treatAsRefreshes:] + 672
14 CoreData 0x048db28a __77-[NSFetchedResultsController(PrivateMethods) _managedObjectContextDidChange:]_block_invoke + 1946
15 CoreData 0x047e8454 developerSubmittedBlockToNSManagedObjectContextPerform + 196
16 CoreData 0x047e8337 -[NSManagedObjectContext performBlockAndWait:] + 231
17 CoreData 0x048daacf -[NSFetchedResultsController(PrivateMethods) _managedObjectContextDidChange:] + 127
18 Foundation 0x0411b929 __57-[NSNotificationCenter addObserver:selector:name:object:]_block_invoke + 40
19 CoreFoundation 0x04e62974 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 20
20 CoreFoundation 0x04d5061b _CFXNotificationPost + 3051
21 Foundation 0x0410af26 -[NSNotificationCenter postNotificationName:object:userInfo:] + 98
22 CoreData 0x047c94d3 -[NSManagedObjectContext(_NSInternalNotificationHandling) _postObjectsDidChangeNotificationWithUserInfo:] + 83
23 CoreData 0x0486954f -[NSManagedObjectContext(_NSInternalChangeProcessing) _createAndPostChangeNotification:withDeletions:withUpdates:withRefreshes:] + 367
24 CoreData 0x047c4d78 -[NSManagedObjectContext(_NSInternalChangeProcessing) _postRefreshedObjectsNotificationAndClearList] + 136
25 CoreData 0x047c483b -[NSManagedObjectContext(_NSInternalChangeProcessing) _processRecentChanges:] + 4875
26 CoreData 0x047c3516 -[NSManagedObjectContext processPendingChanges] + 54
27 CoreData 0x047969d7 _performRunLoopAction + 327
28 CoreFoundation 0x04dbafbe __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
29 CoreFoundation 0x04dbaf00 __CFRunLoopDoObservers + 400
30 CoreFoundation 0x04db093a __CFRunLoopRun + 1226
31 CoreFoundation 0x04db01ab CFRunLoopRunSpecific + 443
32 CoreFoundation 0x04daffdb CFRunLoopRunInMode + 123
33 GraphicsServices 0x05e4224f GSEventRunModal + 192
34 GraphicsServices 0x05e4208c GSEventRun + 104
35 UIKit 0x02f56e16 UIApplicationMain + 1526
36 MyApplication 0x000a9e04 main + 164
37 libdyld.dylib 0x06483ac9 start + 1
)
Receiving random crash reports related to NSFetchedResultsController updates to a UITableView, but I'm having a difficult time deciphering the crash log since it's all internal iOS methods.
This occurs at random times after data is fetched from a server in a background queue and the app populates new NSManagedObjects in the background into a Core Data Persistent Store.
Does anyone have an understanding of what may be going on here?
SIGSEGV
0 libobjc.A.dylib 0x3930b752 lookUpImpOrForward + 46
1 libobjc.A.dylib 0x39303feb _class_lookupMethodAndLoadCache3 + 35
2 libobjc.A.dylib 0x39303db9 _objc_msgSend_uncached + 25
3 UIKit 0x317b2bbf __66-[UISectionRowData refreshWithSection:tableView:tableViewRowData:]_block_invoke + 451
4 UIKit 0x31778179 -[UISectionRowData refreshWithSection:tableView:tableViewRowData:] + 3717
5 UIKit 0x3189c95b -[UITableViewRowData ensureAllSectionsAreValid] + 167
6 UIKit 0x31873f29 -[UITableView _endCellAnimationsWithContext:] + 217
7 CoreData 0x2ecae7dd -[NSFetchedResultsController(PrivateMethods) _managedObjectContextDidChange:] + 4013
8 CoreFoundation 0x2eef4121 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 13
9 CoreFoundation 0x2ee68317 _CFXNotificationPost + 1719
10 Foundation 0x2f84cdcd -[NSNotificationCenter postNotificationName:object:userInfo:] + 77
11 CoreData 0x2ecad813 -[NSManagedObjectContext(_NSInternalNotificationHandling) _postObjectsDidChangeNotificationWithUserInfo:] + 79
12 CoreData 0x2ecad7ab -[NSManagedObjectContext(_NSInternalChangeProcessing) _createAndPostChangeNotification:withDeletions:withUpdates:withRefreshes:] + 299
13 CoreData 0x2ecabe13 -[NSManagedObjectContext(_NSInternalChangeProcessing) _processRecentChanges:] + 2367
14 CoreData 0x2ed159e3 -[NSManagedObjectContext(_NestedContextSupport) _parentProcessSaveRequest:inContext:error:] + 1315
15 CoreData 0x2ed1632f __82-[NSManagedObjectContext(_NestedContextSupport) executeRequest:withContext:error:]_block_invoke + 563
16 libdispatch.dylib 0x397f31a7 _dispatch_barrier_sync_f_slow_invoke + 67
17 libdispatch.dylib 0x397ebd67 _dispatch_client_callout + 23
18 libdispatch.dylib 0x397f27c1 _dispatch_main_queue_callback_4CF$VARIANT$mp + 269
19 CoreFoundation 0x2eefc821 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
20 CoreFoundation 0x2eefb0f5 __CFRunLoopRun + 1301
21 CoreFoundation 0x2ee65ce7 CFRunLoopRunSpecific + 523
22 CoreFoundation 0x2ee65acb CFRunLoopRunInMode + 107
23 GraphicsServices 0x33b86283 GSEventRunModal + 139
24 UIKit 0x31707a41 UIApplicationMain + 1137
25 0x000ba53f main (main.m:16)