1

I have to fetch all books having tags that selected book has.

BOOK <<-->> TAGS

A book can have multiple tags. If suppose i select a book and that has tags "database, algorithms". Then it should select all books that has tags "database", "algorithms", and both "database, algorithms".

My Predicate to fetch from core data is :

request.predicate = [NSPredicate predicateWithFormat:@"(ANY %K IN %@)",
                         REL_BOOK_TAG_LIST, tagList];

where tagList is of selected book's tagList (of type NSSet). I also tried using NSArray but didn't work. I am going in correct direction of should have to do something differnt? Please help me. Thanks.

4

1 回答 1

0

尝试这个...

[request setPredicate:[NSPredicate predicateWithFormat:@"ANY tags IN %@", tagList]];

应该工作的是 tagList 是一个实际Tag对象的数组,并且tagsrelationshipBookto的名称Tag

于 2013-04-03T15:12:56.637 回答