I have a 开发者_StackOverflowtable view controller which fetches items using fetched results controller for each row. When a row is selected it pushes a new view controller to edit that particular managed object model - when I edit and try to save I get the following. What is the cause? Thanks
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
.
This part of the error:
...Can't use in/contains operator with collection 0 (not a collection)...
usually indicates a bad predicate, most likely on a fetch or fetched attribute. You've mostly likely tried to use the IN
or CONTAINS
operator in a predicate without supply an actual collection of values that the targeted objects attributes could be in. E.g
NSPredicate *p=[NSPredicate predicateWithFormat:@"attribute1 IN %@", @"a string not an array"];
...vs:
NSArray *inCollection=[NSArray arrayWithObjects:@"Tom",@"Dick",@"Harry",nil];
NSPredicate *p=[NSPredicate predicateWithFormat:@"attribute1 IN %@", inCollection];
Presumably, something you are changing in your edit is breaking your predicate in the table's fetch. You also want to make sure you've implemented the fetched results controller's delegate methods so that if an object is inserted, deleted or changed, the table will be properly updated to reflect those changes.
(The rest of the error is irrelevant. It's just a framework warning you can't do anything about.)
精彩评论