|
@@ -149,22 +149,22 @@ NSArray * AFQueryStringPairsFromKeyAndValue(NSString *key, id value) {
|
|
NSDictionary *dictionary = value;
|
|
NSDictionary *dictionary = value;
|
|
// Sort dictionary keys to ensure consistent ordering in query string, which is important when deserializing potentially ambiguous sequences, such as an array of dictionaries
|
|
// Sort dictionary keys to ensure consistent ordering in query string, which is important when deserializing potentially ambiguous sequences, such as an array of dictionaries
|
|
NSSortDescriptor *sortDescriptor = [NSSortDescriptor sortDescriptorWithKey:@"description" ascending:YES selector:@selector(caseInsensitiveCompare:)];
|
|
NSSortDescriptor *sortDescriptor = [NSSortDescriptor sortDescriptorWithKey:@"description" ascending:YES selector:@selector(caseInsensitiveCompare:)];
|
|
- [[[dictionary allKeys] sortedArrayUsingDescriptors:[NSArray arrayWithObject:sortDescriptor]] enumerateObjectsUsingBlock:^(id nestedKey, __unused NSUInteger idx, __unused BOOL *stop) {
|
|
|
|
- id nestedValue = [dictionary objectForKey:nestedKey];
|
|
|
|
|
|
+ for (id nestedKey in [dictionary.allKeys sortedArrayUsingDescriptors:@[ sortDescriptor ]]) {
|
|
|
|
+ id nestedValue = dictionary[nestedKey];
|
|
if (nestedValue) {
|
|
if (nestedValue) {
|
|
[mutableQueryStringComponents addObjectsFromArray:AFQueryStringPairsFromKeyAndValue((key ? [NSString stringWithFormat:@"%@[%@]", key, nestedKey] : nestedKey), nestedValue)];
|
|
[mutableQueryStringComponents addObjectsFromArray:AFQueryStringPairsFromKeyAndValue((key ? [NSString stringWithFormat:@"%@[%@]", key, nestedKey] : nestedKey), nestedValue)];
|
|
}
|
|
}
|
|
- }];
|
|
|
|
|
|
+ }
|
|
} else if ([value isKindOfClass:[NSArray class]]) {
|
|
} else if ([value isKindOfClass:[NSArray class]]) {
|
|
NSArray *array = value;
|
|
NSArray *array = value;
|
|
- [array enumerateObjectsUsingBlock:^(id nestedValue, __unused NSUInteger idx, __unused BOOL *stop) {
|
|
|
|
|
|
+ for (id nestedValue in array) {
|
|
[mutableQueryStringComponents addObjectsFromArray:AFQueryStringPairsFromKeyAndValue([NSString stringWithFormat:@"%@[]", key], nestedValue)];
|
|
[mutableQueryStringComponents addObjectsFromArray:AFQueryStringPairsFromKeyAndValue([NSString stringWithFormat:@"%@[]", key], nestedValue)];
|
|
- }];
|
|
|
|
|
|
+ }
|
|
} else if ([value isKindOfClass:[NSSet class]]) {
|
|
} else if ([value isKindOfClass:[NSSet class]]) {
|
|
NSSet *set = value;
|
|
NSSet *set = value;
|
|
- [set enumerateObjectsUsingBlock:^(id obj, BOOL *stop) {
|
|
|
|
|
|
+ for (id obj in set) {
|
|
[mutableQueryStringComponents addObjectsFromArray:AFQueryStringPairsFromKeyAndValue(key, obj)];
|
|
[mutableQueryStringComponents addObjectsFromArray:AFQueryStringPairsFromKeyAndValue(key, obj)];
|
|
- }];
|
|
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
[mutableQueryStringComponents addObject:[[AFQueryStringPair alloc] initWithField:key value:value]];
|
|
[mutableQueryStringComponents addObject:[[AFQueryStringPair alloc] initWithField:key value:value]];
|
|
}
|
|
}
|
|
@@ -605,12 +605,12 @@ static void AFNetworkReachabilityReleaseCallback(const void *info) {
|
|
originalCompletionBlock();
|
|
originalCompletionBlock();
|
|
}
|
|
}
|
|
|
|
|
|
- __block NSUInteger numberOfFinishedOperations = 0;
|
|
|
|
- [operations enumerateObjectsUsingBlock:^(id obj, __unused NSUInteger idx, __unused BOOL *stop) {
|
|
|
|
- if ([(NSOperation *)obj isFinished]) {
|
|
|
|
|
|
+ NSUInteger numberOfFinishedOperations = 0;
|
|
|
|
+ for (NSOperation *operation in operations) {
|
|
|
|
+ if (operation.isFinished) {
|
|
numberOfFinishedOperations++;
|
|
numberOfFinishedOperations++;
|
|
}
|
|
}
|
|
- }];
|
|
|
|
|
|
+ }
|
|
|
|
|
|
if (progressBlock) {
|
|
if (progressBlock) {
|
|
progressBlock(numberOfFinishedOperations, [operations count]);
|
|
progressBlock(numberOfFinishedOperations, [operations count]);
|