tee*_*yay 5 core-data objective-c
我有一个带整数字段的表.我想选择该字段包含任意几个不同值的所有行.
我正在使用这个:
[NSPredicate predicateWithFormat:@"myIntValue IN {1,2,3,4}"]
Run Code Online (Sandbox Code Playgroud)
但这只返回myIntValue1的行.
我究竟做错了什么?
tee*_*yay 10
这有效:
NSFetchRequest *request = [[NSFetchRequest alloc] init];
NSArray *idList = [NSArray arrayWithObjects:[NSNumber numberWithInt:1],
[NSNumber numberWithInt:2],
[NSNumber numberWithInt:3],
[NSNumber numberWithInt:4],
nil];
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"idealForId IN $IDLIST"];
request.predicate = [predicate predicateWithSubstitutionVariables:
[NSDictionary dictionaryWithObject:idList forKey:@"IDLIST"]];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3522 次 |
| 最近记录: |