So, my scenario is this:
I have an NSManagedObject subclass in my iOS application, and as a property I want to store the contents of an MKPolygon object. The way I\'
Never call [super valueForKey:..] in a NSManagedObject subclass! (unless you implemented them in a superclass yourself) Instead use the primitive accessor methods.
Sample getter/setter implementation from ADC:
@interface Department : NSManagedObject
@property(nonatomic, strong) NSString *name;
@end
@interface Department (PrimitiveAccessors)
- (NSString *)primitiveName;
- (void)setPrimitiveName:(NSString *)newName;
@end
@implementation Department
@dynamic name;
- (NSString *)name
{
[self willAccessValueForKey:@"name"];
NSString *myName = [self primitiveName];
[self didAccessValueForKey:@"name"];
return myName;
}
- (void)setName:(NSString *)newName
{
[self willChangeValueForKey:@"name"];
[self setPrimitiveName:newName];
[self didChangeValueForKey:@"name"];
}
@end