我有一个用户可以用任意数量的标签标记的实体。标签本身就是一个实体,具有多对多的关系。
假设_filterTags是一个包含对用户想要过滤的标记的引用的数组,则下面的谓词运行
predicate = [NSPredicate predicateWithFormat:@"ANY tags IN %@",_filterTags];
但不幸的是,这只需要其中一个标签匹配。
我希望所有人都能工作:
predicate = [NSPredicate predicateWithFormat:@"ALL tags IN %@",_filterTags];
但这会导致
NSInvalidArgumentException', reason: 'Unsupported predicate (null)'
知道我做错了吗?