I’m overriding a Core Data setter with this code:
- (void)setName:(NSString *)newName
{
[self willChangeValueForKey:@"name"];
[self setPrimitiveName:newName];
[self didChangeValueForKey:@"name"];
}
It works perfectly, however I’m getting the a compiler warning:
warning: 'MyClass' may not respond to '-setPrimitiveName:newName:'
Is this correct? If so, can I suppress this warning ?
Thanks
Yes, that is the correct way to do it. The
setPrimitiveName:method will be generated automatically by Core Data. To get rid of the warning, add a category interface at the top of your implementation file which declares primitive accessors.