I am trying to filter an array of NSManagedObjects by deleted = NO this filtering does not work. The deleted field has a default value so nil should not be an issue.
Asked
Active
Viewed 213 times
1
Kyle Redfearn
- 2,172
- 16
- 34
-
possible duplicate of [Core Data NSPredicate predicateWithBlock and predicateWithFormat in Parent Child Context](http://stackoverflow.com/questions/16000242/core-data-nspredicate-predicatewithblock-and-predicatewithformat-in-parent-child) – Martin R Mar 05 '14 at 05:40
2 Answers
2
The answer to this question is to change the field name. There are some secret reserved words used in CoreData that are not apparent. I have had issues with other fields called address1 and name too. This person has also had problems with readOnly: http://lists.apple.com/archives/cocoa-dev/2007/Nov/msg00412.html
Kyle Redfearn
- 2,172
- 16
- 34
0
comparing your BOOL in an NSPredicate this way should work:
[NSPredicate predicateWithFormat:@"deleted == %@", [NSNumber numberWithBool: NO]];
Sascha Manuel Hameister
- 966
- 5
- 28
-
Using a plain old `BOOL` is fine in a predicate, as long as the format string uses `%d`. – Tom Harrington Mar 04 '14 at 23:50