Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>So, it appears that we've established in the comments to the original post that this is likely caused by SQLite stores being incompatible with block predicates, since Core Data cannot translate these to SQL to run them in the store (thanks, JoostK).</p> <p>There might be a couple of ways to overcome this:</p> <ul> <li>Provided that the end date of your entities is a regular attribute, you might be able to express the expiry constraint as a predicate format string instead of a block predicate, which Core Data should be able to translate into a SQL clause.</li> <li>If the above is possible, you will probably prefer to use a <a href="http://developer.apple.com/iphone/library/documentation/cocoa/conceptual/CoreData/Articles/cdUsingMOM.html#//apple_ref/doc/uid/TP40005190-SW7" rel="noreferrer">fetch request template</a> to retrieve the expired items. You would need to pass in a substitution variable like <code>$NOW</code> to give access to the current date, though. This has the advantage of making the predicate template show up in the model editor.</li> <li>Both approaches, however, have the disadvantage of duplicating existing functionality (i.e., your <code>isExpired</code> method). So another way would be fetch all qualifiying entities regardless of their expiry state first, and then run a dedicated filtering step on the resulting set of entities to weed out the non-expired ones. Since by that point, they have been fully resurrected from the store, you should be able to use a block predicate for this.</li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload