From 7207f2f19f6f93a549432e1b5316bccc74cee2d8 Mon Sep 17 00:00:00 2001 From: "@scutdavy" Date: Sat, 6 Apr 2013 20:06:15 +0200 Subject: [PATCH] Using indexesOfObjectsPassingTest to calculate numberOfFinishedOperations in -enqueueBatchOfHTTPRequestOperations: Signed-off-by: Mattt Thompson --- AFNetworking/AFHTTPClient.m | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/AFNetworking/AFHTTPClient.m b/AFNetworking/AFHTTPClient.m index f349796..47a0119 100644 --- a/AFNetworking/AFHTTPClient.m +++ b/AFNetworking/AFHTTPClient.m @@ -605,12 +605,9 @@ static void AFNetworkReachabilityReleaseCallback(const void *info) { originalCompletionBlock(); } - NSUInteger numberOfFinishedOperations = 0; - for (NSOperation *operation in operations) { - if (operation.isFinished) { - numberOfFinishedOperations++; - } - } + NSInteger numberOfFinishedOperations = [[operations indexesOfObjectsPassingTest:^BOOL(id op, NSUInteger idx, BOOL *stop) { + return [op isCancelled]; + }] count]; if (progressBlock) { progressBlock(numberOfFinishedOperations, [operations count]);