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)];
}
}
我应如何从作为切除1的跳板的NSManagedObject子级方法中收回“attrib1”这一特性的价值。
成就