我有以下过滤数组 2 的响应
if(requestType == RequestTypeGetReportMaterialStatus)
{
materialStatusArray=response[@"customerstatus"];
NSLog(@"Filtered Array2%@",materialStatusArray);
}
1 = {
bookingid = 469;
status = 1;
};
2 = {
bookingid = 493;
status = 1;
};
3 = {
bookingid = 486;
status = 1;
};
4 = {
bookingid = 501;
status = 1;
};
5 = {
bookingid = 506;
status = 1;
};
但是我想对存储在数组中的响应,该数组通过削减数字给出以下内容
{
bookingid = 469;
status = 1;
};
{
bookingid = 493;
status = 1;
};
{
bookingid = 486;
status = 1;
};
{
bookingid = 501;
status = 1;
};
{
bookingid = 506;
status = 1;
};
我如何获得上述格式的数组响应以访问预订ID和状态值以进行比较...请根据我的回答提供代码片段来帮助我。
提前谢谢。
我想materialStatusArray
实际上是一个 NSDictionary,数组可以像这样转换:
NSMutableArray *arrayWithoutNumbers = [NSMutableArray array];
if ([materialStatusArray isKindOfClass:[NSDictionary class]]) {
NSDictionary *dict = (NSDictionary *)materialStatusArray;
[dict enumerateKeysAndObjectsUsingBlock:^(id _Nonnull key, id _Nonnull obj, BOOL * _Nonnull stop) {
[arrayWithoutNumbers addObject:obj];
}]
}