如何删除整个 NSArray 中不同的 JSON objectForKey?
How to remove a JSON objectForKey which is different throughout the NSArray?
我有以下过滤数组 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;
};
我怎样才能得到上述格式的数组响应来访问 bookingid 和状态值以进行比较...请根据我的响应提供代码片段来帮助我。
提前致谢。
我猜 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];
}]
}
我有以下过滤数组 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;
};
我怎样才能得到上述格式的数组响应来访问 bookingid 和状态值以进行比较...请根据我的响应提供代码片段来帮助我。
提前致谢。
我猜 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];
}]
}