Merge branch 'master' of github.com:AFNetworking/AFNetworking

This commit is contained in:
Mattt Thompson 2013-04-06 15:42:36 +02:00
Родитель 205a8aa7e3 c943d8a7b5
Коммит 25dcdcaf75
1 изменённых файлов: 11 добавлений и 11 удалений

Просмотреть файл

@ -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]);