I have an attribute with an int_32 property called seconds. In a category, I restate the property as readonly and override the getter to create it from other properties. The issue is when I use
[NSPredicate predicateWithFormat:@"SELF.seconds > %i"];
The predicate does not work because the getter is not called by the predicate. It is called in my other code just fine, just not in the predicate. Anyone know why this would happen or how to get around this problem? (besides recreating NSFetchedResultsController).
The predicate is converted into SQL and run on the store. It doesn't run any of your code. As such you can only use the stored value in the data store. No transient attributes, no methods.
If you want to use the attribute in a fetch then you should save the value. This could be done by implementing willSave
and having it set the value just before any other value changes are saved.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments