diff --git a/AFNetworking/AFHTTPClient.m b/AFNetworking/AFHTTPClient.m index bd0cab2..f349796 100644 --- a/AFNetworking/AFHTTPClient.m +++ b/AFNetworking/AFHTTPClient.m @@ -149,22 +149,22 @@ NSArray * AFQueryStringPairsFromKeyAndValue(NSString *key, id 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 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) { [mutableQueryStringComponents addObjectsFromArray:AFQueryStringPairsFromKeyAndValue((key ? [NSString stringWithFormat:@"%@[%@]", key, nestedKey] : nestedKey), nestedValue)]; } - }]; + } } else if ([value isKindOfClass:[NSArray class]]) { 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)]; - }]; + } } else if ([value isKindOfClass:[NSSet class]]) { NSSet *set = value; - [set enumerateObjectsUsingBlock:^(id obj, BOOL *stop) { + for (id obj in set) { [mutableQueryStringComponents addObjectsFromArray:AFQueryStringPairsFromKeyAndValue(key, obj)]; - }]; + } } else { [mutableQueryStringComponents addObject:[[AFQueryStringPair alloc] initWithField:key value:value]]; } @@ -605,12 +605,12 @@ static void AFNetworkReachabilityReleaseCallback(const void *info) { 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++; } - }]; + } if (progressBlock) { progressBlock(numberOfFinishedOperations, [operations count]);