开发者

Core data select objects from an array - iPhone

开发者 https://www.devze.com 2022-12-22 09:56 出处:网络
I was wondering if I could select objects based on a predicate with an array... for example Code: [NSPredicate predicateWithFormat:@\"id=%@开发者_Go百科\", arrayOfID];

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

Code: [NSPredicate predicateWithFormat:@"id=%@开发者_Go百科", arrayOfID];

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

Best


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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消