I have a core data entity and I've created a NSManagedObject subclass. Say it has a attribute, "attrib1" within entity "List". In my subclass, in some cases I'd like to calculate the value of attrib1, in other cases I'd like to return the value from the database. I'm trying to figure out how to return the database value from within my method. Example:
- (NSString *)attrib1 {
if (flag) {
return [self calculateValue];
} else {
// return value from core data, ie pass thru, but how?
// Attempt1:
return [super attrib1]; // Fails with 'unrecognized selector'
// Attempt2. Ends up calling this method again, recursion loop
return [super performSelector:@selector(attrib1)];
}
}
How should I retrieve the value of the attribute "attrib1" from within the NSManagedObject subclass method which is the getter for attrib1.
Thanks