NSPredicate in NSFetchedResultsController doesn't use Category's getter

Kevin

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).

Wain

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.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

Why doesn't lombok provide a getter method for inherited attribute?

From Dev

iCloud and Core Data. NSFetchedResultsController doesn't update on initial sync

From Dev

NSFetchedResultsController didChangeObject with a filtering NSPredicate

From Dev

Is it possible to have an NSFetchedResultsController delete an object if one of the object's properties doesn't fulfil it's predicate?

From Dev

Play framework 2.2.0 doesn't generate getter/setter automatically

From Dev

why doesn't it want to add a post or category?

From Dev

QtCreator's designer doesn't use size bindings

From Dev

NSFetchedResultsController doesn't always call didChangeObject:atIndexPath:forChangeType:newIndexPath: for NSFetchedResultsChangeMove

From Dev

Wordpress category filter doesn't filter on sub categories

From Dev

Faces message added in getter method doesn't display in messages component

From Dev

Possible to use "self" with NSSortDescriptor to sort by the object itself, rather than object's property? (Core Data / NSFetchedResultsController)

From Dev

query_posts on category ID doesn't work

From Dev

AWS Data Pipeline doesn't use DynamoDB's indexes

From Dev

One getter syntax works, but the other doesn't?

From Dev

WP-REST API excluding category doesn't work

From Dev

std::sort doesn't recognise iterator category

From Dev

Lazy getter doesn't work in classes

From Dev

creating category if it doesn't exist, print current data if it does

From Dev

NSFetchedResultsController doesn’t update from background contexts (DATAStack)

From Dev

Compiler doesn't recognize Lombok Getter for overriden method

From Dev

The squid's rule "undocumentedapi" doesn't exclude some getter methods

From Dev

Getter function from defineProperty doesn't return selector

From Dev

Swift editing related Core Data objects with NSFetchedResultsController across views / how do I format and use NSPredicate with a block?

From Dev

Are there any GUI's for Linux that doesn't use X11?

From Dev

Why doesn't this simple NSPredicate filter my array

From Dev

NSWorkspace's 'frontmostApplication' doesn't change after initial use

From Dev

NSFetchedResultsController doesn’t update from background contexts (DATAStack)

From Dev

Instagram doesn't use jwt on it's authentication

From Dev

Wordpress my query post doesn't display my post with category

Related Related

  1. 1

    Why doesn't lombok provide a getter method for inherited attribute?

  2. 2

    iCloud and Core Data. NSFetchedResultsController doesn't update on initial sync

  3. 3

    NSFetchedResultsController didChangeObject with a filtering NSPredicate

  4. 4

    Is it possible to have an NSFetchedResultsController delete an object if one of the object's properties doesn't fulfil it's predicate?

  5. 5

    Play framework 2.2.0 doesn't generate getter/setter automatically

  6. 6

    why doesn't it want to add a post or category?

  7. 7

    QtCreator's designer doesn't use size bindings

  8. 8

    NSFetchedResultsController doesn't always call didChangeObject:atIndexPath:forChangeType:newIndexPath: for NSFetchedResultsChangeMove

  9. 9

    Wordpress category filter doesn't filter on sub categories

  10. 10

    Faces message added in getter method doesn't display in messages component

  11. 11

    Possible to use "self" with NSSortDescriptor to sort by the object itself, rather than object's property? (Core Data / NSFetchedResultsController)

  12. 12

    query_posts on category ID doesn't work

  13. 13

    AWS Data Pipeline doesn't use DynamoDB's indexes

  14. 14

    One getter syntax works, but the other doesn't?

  15. 15

    WP-REST API excluding category doesn't work

  16. 16

    std::sort doesn't recognise iterator category

  17. 17

    Lazy getter doesn't work in classes

  18. 18

    creating category if it doesn't exist, print current data if it does

  19. 19

    NSFetchedResultsController doesn’t update from background contexts (DATAStack)

  20. 20

    Compiler doesn't recognize Lombok Getter for overriden method

  21. 21

    The squid's rule "undocumentedapi" doesn't exclude some getter methods

  22. 22

    Getter function from defineProperty doesn't return selector

  23. 23

    Swift editing related Core Data objects with NSFetchedResultsController across views / how do I format and use NSPredicate with a block?

  24. 24

    Are there any GUI's for Linux that doesn't use X11?

  25. 25

    Why doesn't this simple NSPredicate filter my array

  26. 26

    NSWorkspace's 'frontmostApplication' doesn't change after initial use

  27. 27

    NSFetchedResultsController doesn’t update from background contexts (DATAStack)

  28. 28

    Instagram doesn't use jwt on it's authentication

  29. 29

    Wordpress my query post doesn't display my post with category

HotTag

Archive