Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Core data select objects from an array

I was wondering if I could select objects based on a predicate with an array... for example

Code:

[NSPredicate predicateWithFormat:@"id=%@", arrayOfID];

Will it work? If no, how can I do it?

like image 782
ncohen Avatar asked Feb 11 '26 17:02

ncohen


1 Answers

The correct predicate would be

[NSPredicate predicateWithFormat:@"id IN %@", arrayOfID];

Assuming that arrayOfId contains objects of the same type as id (e.g. NSNumbers or NSStrings).

like image 149
Felix Lamouroux Avatar answered Feb 13 '26 16:02

Felix Lamouroux