名为NSMutableArray
的{{1}},它使用arrayDB
从服务器获取数据,就像这样
AFNetworking
结果就是这样。
[self.arrayDB addObjectsFromArray:[responseObject objectForKey:@"list"]];
NSLog(@"print:%@",self.arrayDB);
现在,我使用sql语句来描述我的需求, print:(
{
id = 10;
key = 7707eca6ea4d2db923c8b7b4e6ec094c;
},
{
id = 9;
key = 7aaf962bc4df61a3b44c544c58fc6c82;
},
{
id = 7;
key = ce9d9e99a96d6417c6b34321c820c4c0;
},
{
id = 6;
key = 6086663465e5813d08f862eb443e2623;
},
{
id = 4;
key = 5d9519dd7de26f0139d6028fb83a4ead;
}
)
,我怎么能写出Objective-C?
答案 0 :(得分:0)
您可以像这样使用NSPredicate
:
NSArray *myArray = [self.arrayDB filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"(id == %@)", @"10"]];