I am making a method that will remove all of my NSManagedObjects that were not updated in the last sync.
- (void)removeStaleObjects {
// Delete obje
The problem is the name "updated" of your attribute. It conflicts with the isUpdated
method of NSManagedObject
. (See Core Data NSPredicate "deleted == NO" does not work as expected for a similar issue with a "deleted" attribute.)
If you rename your attribute, everything works as expected.
It also looks to my that your predicate is formatted correctly. Here are a couple things you can do:
1) When debugging this, print out that predicate. You should see something like:
updatedDate < {some integer value}
Dates are stored as integers under the covers, and a predicate converts it properly as well. If your predicate isn't printable in the debugger, you'll know right away
2) Check your updatedDate type. Make sure that's a date (I trust it's already a date, but you didn't specify in your question)
3) Make sure your Node object has the updatedDate attribute on it.