From cac44aeb34da30f2a52f39f39bae51f46a15c0a0 Mon Sep 17 00:00:00 2001 From: Mattt Thompson Date: Thu, 1 Mar 2012 09:09:17 -0800 Subject: [PATCH] Skip non-AFHTTPRequestOperations in AFHTTPClient -cancelAllHTTPOperationsWithMethod --- AFNetworking/AFHTTPClient.m | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/AFNetworking/AFHTTPClient.m b/AFNetworking/AFHTTPClient.m index 3f826c0..503784e 100644 --- a/AFNetworking/AFHTTPClient.m +++ b/AFNetworking/AFHTTPClient.m @@ -416,8 +416,12 @@ static void AFReachabilityCallback(SCNetworkReachabilityRef __unused target, SCN } - (void)cancelAllHTTPOperationsWithMethod:(NSString *)method path:(NSString *)path { - for (AFHTTPRequestOperation *operation in [self.operationQueue operations]) { - if ((!method || [method isEqualToString:[[operation request] HTTPMethod]]) && [path isEqualToString:[[[operation request] URL] path]]) { + for (NSOperation *operation in [self.operationQueue operations]) { + if (![operation isKindOfClass:[AFHTTPRequestOperation class]]) { + continue; + } + + if ((!method || [method isEqualToString:[[(AFHTTPRequestOperation *)operation request] HTTPMethod]]) && [path isEqualToString:[[[(AFHTTPRequestOperation *)operation request] URL] path]]) { [operation cancel]; } }