I want to be able to override the getter on a string property on one of my core data models and inside the getter I need to find out what the value is for that property.
@interface LabTest : NSManagedObject {
}
@property (nonatomic, retain) NSString *status;
@end
@implementation LabTest
@dynamic status;
- (NSString *)status {
NSString *tempStatus = [super valueForKey:@"status"];
//do some checking here
return tempStatus;
}
@end
The code above crashes the process. I have tried a few different things, but I think they all end up in an infinite loop with the program crashing with a code of 139.
What is the correct way to access a core data member in the getter like this?
Have you tried [self primitiveValueForKey:@"status"]
instead of [super valueForkey:@"status"]
?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With