如何在同一个键

时间:2018-04-17 10:33:12

标签: ios objective-c nspredicate

我有一个字典数组,我想获取具有这些值D1,D12,D14的数据

例如:

[@{"district":"D1"}, {"district":"D2"}, {"district":"D2"}, {"district":"D12"}, {"district":"D15"}, {"district":"D14"}, {"district":"D14"}, {"district":"D12"}, {"district":"D1"}, {"district":"D18"}, {"district":"D17"}]

2 个答案:

答案 0 :(得分:0)

[NSPredicate predicateWithFormat:@"分区IN%@",@ [@" D1",@" D12",@" D14&# 34]

答案 1 :(得分:-1)

var resultPredicate:NSPredicate = NSPredicate()

resultPredicate = NSPredicate(format: "district = %@", ["D1","D12","D14"])