سؤال

I have a Core Data object that has an NSOrderedSet of Core Data objects in it called hierarchyItems. I want to create a fetch request that will check to see if the hierarchyItems set contains an object that is also in another NSMutableSet of Core Data objects.I would like to create a NSPredicate or NSExpression that has the same functionality as

[obj.hierarchyItems intersectsSet: setOfItems];
هل كانت مفيدة؟

المحلول

To fetch the object for which hierarchyItems has a non-empty intersection with setOfItems, use a fetch request with the predicate

[NSPredicate predicateWithFormat:@"ANY hierarchyItems IN %@", setOfItems]
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top