0

我有一个表格视图控制器,它使用获取的结果控制器为每一行获取项目。选择一行时,会推动新的视图控制器编辑该特定的托管对象模型 - 当我编辑并尝试保存时,我将获得以下内容。原因是什么?谢谢

Serious application error.  Exception was caught during Core Data change processing.  This is usually a bug within an observer of NSManagedObjectContextObjectsDidChangeNotification.  Can't use in/contains operator with collection 0 (not a collection) with userInfo (null)
Detected an attempt to call a symbol in system libraries that is not present on the iPhone:
_Unwind_Resume called from function -[NSManagedObjectContext(_NSInternalChangeProcessing) _processRecentChanges:] in image CoreData

.

4

1 回答 1

3

这部分错误:

...Can't use in/contains operator with collection 0 (not a collection)...

通常表示错误的谓词,最有可能在 fetch 或 fetched 属性上。您很可能尝试在谓词中使用INorCONTAINS运算符,但没有提供目标对象属性可能包含的实际值集合。例如

NSPredicate *p=[NSPredicate predicateWithFormat:@"attribute1 IN %@", @"a string not an array"];

...与:

NSArray *inCollection=[NSArray arrayWithObjects:@"Tom",@"Dick",@"Harry",nil];
NSPredicate *p=[NSPredicate predicateWithFormat:@"attribute1 IN %@", inCollection];

据推测,您在编辑中更改的内容可能会破坏表获取中的谓词。您还需要确保已实现获取结果控制器的委托方法,以便在插入、删除或更改对象时,表格将正确更新以反映这些更改。

(错误的其余部分无关紧要。这只是一个框架警告,您无能为力。)

于 2011-03-09T15:54:09.883 回答