NSPredicate包含列表

Coc*_*Nub 0 nspredicate ios

我有一个标签列表,如第1项,第2项,我希望使用NSPredicate过滤数组,如果字段匹配这些项目中的任何内容.这没有完成它:

NSPredicate *predicate = [NSPredicate predicateWithFormat:@"ANY tags CONTAINS[c] %@", tag];
results = [results filteredArrayUsingPredicate:predicate];
Run Code Online (Sandbox Code Playgroud)

ser*_*rgi 5

使用IN运算符,后跟标记数组.

predicate = [NSPredicate predicateWithFormat:@"ANY tags IN %@", theTags];
Run Code Online (Sandbox Code Playgroud)