I implemented a KVC validation method that is called by coredata, but is not being called when I call
person.name = @”alice”;
is there a reason why KVC validation methods, in this case,
- (BOOL)validateName:(id *)ioValue error:(NSError **)outError {
NSLog(@"validateName is validating...");
// ...
}
is not being called when setting a value via property expression?
Another problem is that I can’t get this to work either:
[person setValue:@"ok" forKey:@"name"];
My NSLog line NEVER gets called.
Anything I’m missing?
This class is a subclass of NSManagedObject.
Does that matter?
Thanks,
Jamie
According to the Managed Object Validation documentation, validation methods are not run until the context is saved, or until you manually validate (with
-validateForUpdate:,-validateForInsert:, or-validateForDelete:).