Nate
Nate

Reputation: 7876

Core data select objects from an array - iPhone

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?

Best

Upvotes: 3

Views: 1779

Answers (2)

Felix Lamouroux
Felix Lamouroux

Reputation: 7494

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).

Upvotes: 5

pheelicks
pheelicks

Reputation: 7469

Yes, of course you can do it.

Sounds like you need a bit of grounding in Core Data. I found the following tutorial really useful in getting me off the ground with Core Data:

http://iphoneinaction.manning.com/iphone_in_action/2009/08/core-data-part-1-an-introduction.html

Upvotes: 0

Related Questions