ios - NSPredicate for a Core Data Search -
i have 3 nsmanagedobjet
s; person, stuff, , collection.
i want use nspredicate
list of collection
s theperson
has.
example: scott has objecta , objectb in collection letters , object1 in collection numbers.
i want able fetch request , collection letters , numbers.
i tried:
nspredicate *predicate = [nspredicate predicatewithformat:@"any stuffs.persons == %@", person];
and:
nspredicate *predicate = [nspredicate predicatewithformat:@"subquery(stuffs, $s, $s.persons == %@)", scott];
any suggestions?
your subquery
syntax wrong (for full explanation, see this answer or this answer). should like:
subquery(stuffs, $s, $s.persons == %@).@count > 0
Comments
Post a Comment