我正在为核心数据获取数据的操作如下
NSString *str;
NSPredicate *predicate;
switch (typeCube) {
case NewCubes: {
str = [NSString stringWithFormat:@"type == %d",NewCubes];
break;
}
case AllCubes: {
str = [NSString stringWithFormat:@"type != %d",CustomCubes];
break;
}
case CustomCubes: {
str = [NSString stringWithFormat:@"type == %d",CustomCubes];
break;
}
}
predicate = [NSPredicate predicateWithFormat:@"%@ AND (accounts.keyChainId == %@)", str, accountKeyChainId];
但是,谓词的结果为零。但以下工作
predicate = [NSPredicate predicateWithFormat:@"(type == %d) AND (accounts.keyChainId == %@)", type, accountKeyChainId]; ( type is either NewCubes or AllCubes or CustomCubes)
如果您有任何想法,请提供帮助。欢迎所有评论。谢谢