//通过取出字典的所有key值,利用sortedArrayUsingComparator进行降序排序 - (NSMutableArray *)reqDiction:(NSDictionary *)dict{ NSArray *allKeyArray = [dict allKeys]; NSArray *afterSortKeyArray = [allKeyArray sortedArrayUsingComparator:^NSComparisonResult(id _Nonnull obj1, id _Nonnull obj2) { NSComparisonResult resuest = [obj2 compare:obj1]; //[obj1 compare:obj2]:升序 return resuest; }]; NSLog(@"afterSortKeyArray:%@",afterSortKeyArray); //通过排列的key值获取value NSMutableArray *valueArray = [NSMutableArray array]; for (NSString *sortsing in afterSortKeyArray) { NSString *valueString = [dict objectForKey:sortsing]; [valueArray addObject:valueString]; } return valueArray; }