我正在尝试使用谓词来获取我想要搜索的数据所在的数据 NSSet
@property (nonatomic, retain) NSSet *categories;
@property (nonatomic, retain) NSString *otherDetails;
@property (nonatomic, retain) NSNumber *id;
Run Code Online (Sandbox Code Playgroud)
该NSSet类别是从另一个实体组成,包含:
@property (nonatomic, retain) NSString *name;
@property (nonatomic, retain) NSNumber *id;
Run Code Online (Sandbox Code Playgroud)
然后尝试通过谓词得到这个
NSFetchRequest *fetcher =[NSFetchRequest fetchRequestWithEntityName:@"MyEntity"];
fetcher.predicate = [NSPredicate predicateWithFormat:@categories in %@", catList];
Run Code Online (Sandbox Code Playgroud)
其中catList是:
NSmutableArray *catList = [[NSMutableArray alloc] init];
Run Code Online (Sandbox Code Playgroud)
并填充数据
这就是给我以下错误
'NSInvalidArgumetException', reason: 'unimplemented SQL generation for predicate: (categories IN {"this", "that"});
Run Code Online (Sandbox Code Playgroud)
我尝试将其更改为使用这样的NSSet字段
fetcher.predicate = [NSPredicate predicateWithFormat:@categories.name in %@", catList];
Run Code Online (Sandbox Code Playgroud)
但这没用.
如果我更改谓词使用NSString它不会出错,但由于数据不同,不会返回任何结果.
fetcher.predicate = [NSPredicate predicateWithFormat:@categories …Run Code Online (Sandbox Code Playgroud) 我有一个DB具有以下关系:

A << - >> B
A:会员表; B:活动表
会员有很多活动,每个活动都有很多会员.所以,有多对多的关系.
当用户从tableView中选择一个Activity时,应该使用具有该Activity的所有成员推送一个新的tableView.
在"child"tableView的NSPredicate中,我这样做:
request.entity = [NSEntityDescription entityForName:@"Members" inManagedObjectContext:context];
request.predicate = [NSPredicate predicateWithFormat:@"memberActivity = %@", [NSSet setWithObject:activity]];
Run Code Online (Sandbox Code Playgroud)
结果是:
***由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:'此处不允许使用多对键'
我究竟做错了什么?
谢谢,
RL