3

我收到了这个错误,我无法弄清楚它到底发生在哪里。

这是堆栈跟踪:

0 CoreFoundation 0x382952a3 __exceptionPreprocess + 163
1 libobjc.A.dylib 0x3358d97f objc_exception_throw + 31
2 CoreData 0x398fe0cf -[NSComparisonPredicate(_NSCoreDataSQLPredicateCategories) minimalFormInContext:] + 371
3 CoreData 0x399097af -[NSCompoundPredicateOperator(_NSCoreDataSQLPredicateCategories) minimalFormInContext:ofPredicates:] + 727
4 CoreData 0x398fd917 -[NSSQLGenerator initializeContextForFetchRequest:ignoreInheritance:nestingLevel:] + 539
5 CoreData 0x398fd3b3 -[NSSQLGenerator newSQLStatementForFetchRequest:ignoreInheritance:countOnly:nestingLevel:] + 39
6 CoreData 0x398fd2bd -[NSSQLAdapter _newSelectStatementWithFetchRequest:ignoreInheritance:] + 509
7 CoreData 0x398fced5 -[NSSQLCore newRowsForFetchPlan:] + 117
8 CoreData 0x398fc64f -[NSSQLCore objectsForFetchRequest:inContext:] + 683
9 CoreData 0x398fc119 -[NSSQLCore executeRequest:withContext:error:] + 469
10 CoreData 0x398fb531 -[NSPersistentStoreCoordinator executeRequest:withContext:error:] + 1645
11 CoreData 0x398f9e2b -[NSManagedObjectContext executeFetchRequest:error:] + 647
12 CoreData 0x3996293f -[NSManagedObjectContext(_NestedContextSupport) _parentObjectsForFetchRequest:inContext:error:] + 399
13 CoreData 0x399630c9 __82-[NSManagedObjectContext(_NestedContextSupport) executeRequest:withContext:error:]_block_invoke_0 + 565
14 libdispatch.dylib 0x36eb2621 _dispatch_barrier_sync_f_slow_invoke + 81
15 libdispatch.dylib 0x36ea34b7 _dispatch_client_callout + 23
16 libdispatch.dylib 0x36ea4dcb _dispatch_main_queue_callback_4CF$VARIANT$up + 227
17 CoreFoundation 0x38268f3b __CFRunLoopRun + 1291
18 CoreFoundation 0x381dbebd CFRunLoopRunSpecific + 357
19 CoreFoundation 0x381dbd49 CFRunLoopRunInMode + 105
20 GraphicsServices 0x36f532eb GSEventRunModal + 75
21 UIKit 0x3a3882f9 UIApplicationMain + 1121
22 Sticky Free 0x000ac67b _mh_execute_header + 13947
23 Sticky Free 0x000ab1e0 _mh_execute_header + 8672


And here is the main error.
Invalid predicate: nil RHS

我在进行提取时从 NSPredicate 知道它。但是,我不确定是哪条线导致了它。我正在使用多线程 coredata 环境。

这个问题是非常间歇性的,大约在 10 个会话中出现一次。任何帮助将不胜感激。

谢谢

4

2 回答 2

6

正如其他人所说:一定要设置一个符号断点objc_exception_throw,看看你的哪一个executeFetchRequest会触发错误。从executeFetchRequest滚动到您定义谓词的行。

RHS倾向于代表右手边。假设您正在设置谓词:

[NSPredicate predicateWithFormat:@"%K = %@", attribute, value];

然后RHSvalue。确保value不是nil.

于 2012-12-02T19:29:16.090 回答
0

我发现,我在退出时立即保存了主要上下文。所以,如果我不保存退出时的主上下文,我不会得到这个看起来很奇怪的崩溃。

于 2012-12-06T02:51:36.300 回答