I am getting a crash when changing a BOOL attribute of my NSManagedObject.
The code to save the object is:
self.detailItem.bookmark = [NSNumber numberWithBool:YES];
NSError *error = nil;
if (! [self.detailItem.managedObjectContext save:&error])
{
// Handle the error.
}
NSLog(@"%@", error);
And the error:
Serious application error. Exception was caught during Core Data change processing. This is usually a bug within an observer of NSManagedObjectContextObjectsDidChangeNotification. The left hand side for an ALL or ANY operator must be either an NSArray or an NSSet. with userInfo (null)
2011-08-18 15:41:32.866 Codes[5260:707] *** 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.'
WARNING: This answer is based on a guess I’ve made based on the error message; it might be 100% wrong!
The error looks like it’s an incorrectly formed
NSPredicate. You might have something likeThat looks like it might find anything where
name = 'Bob'but it won’t, it will throw an exception 🙁If you’re using ‘IN’ you need to pass an NSSet or NSArray i.e .
This will find anything with the name ‘Bob’ or ‘Alice’.
If you just wanted to search for ‘Bob’, just do this :