我看到我的一些用户遭遇此次崩溃,虽然它不可复制,所以我不明白它可能意味着什么。堆栈跟踪如下:
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
" save"的代码按下按钮如下:
[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];
}
}];
我无法找到有关异常消息的任何详细信息"无法使用非集合对象执行集合评估。"。任何人都知道这可能指的是什么? 顺便提一下,堆栈所引用的NSFetchedResultsController绑定到UITableView(不是集合视图)。它没有设置任何谓词,所以它不像谓词可能会引起一些问题。
希望通过分析堆栈跟踪来了解这可能意味着什么?
====更多细节====
一个人与Notes有一对多的关系。注释与Person一对一。有不同的NSFetchedResultsControllers正在监听可能受到影响的更改,但是从堆栈跟踪中找不到哪个有问题:
堆栈中的AddEditLogsWithStoryboard.m行是代码片段中的第一行和第7行(performBlockAndWait),因此他们没有特别的帮助。有用的是知道它抱怨哪个集合属性,或者哪个NSFetchedResultsControllers