Using the Xcode 4.2.1 Core Data Model Editor, how does one update a predicate for a fetched property?

StackOverflow https://stackoverflow.com/questions/8653081

Question

When editing a predicate with the Core Data Model Editor in Xcode 4.2.1, how does one persist the updated predicate? Changing the value for the predicate does not seem to persist. The original predicate still applies to the fetched property.

Steps to reproduce:

  1. Create a fetched property (e.g. oddPages on entity Book with related entity Page)
  2. Set predicate to book == $FETCH_SOURCE && isEven != 0.
    (The Book entity should have a relationship to the Page entity, say it's named 'pages'. The Page entity should have an inverse relationship to the Book entity named 'book'. The Page entity also has an attribute pageNumber and an attribute isEven which is set when the page is created based on the pageNumber. The logic of the predicate is deliberately incorrect in this step.)
  3. Build, run, and stop. Now correct the predicate to reflect 'isEven == 0'.
  4. Build and run again. Notice the results fetched for the fetched property are from the original predicate.

Is this a bug or am I missing a key step to update a predicate on a fetched property using the Core Data Model Editor?

Was it helpful?

Solution

As far as I can tell. This is a bug or "feature". To correct the predicate on an existing fetched property using the Core Data Model Editor, delete the fetched property and re-create it with the updated predicate.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top