From 6a46815eafdb3e8b5f46f94502756cd9b226d7ef Mon Sep 17 00:00:00 2001 From: Joel Parsons Date: Mon, 11 Mar 2013 13:15:19 +0000 Subject: [PATCH] The documentations states registered operation classes are consulted to the reverse order in which they are registered. New registrations are added to the beginning of the array in the register implementation. Fixed using the reverseObjectEnumerator when iterating the array which produced the opposite of documented behaviour. fixes #794 --- AFNetworking/AFHTTPClient.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/AFNetworking/AFHTTPClient.m b/AFNetworking/AFHTTPClient.m index f9d2166..d4bba2f 100644 --- a/AFNetworking/AFHTTPClient.m +++ b/AFNetworking/AFHTTPClient.m @@ -517,12 +517,12 @@ static void AFNetworkReachabilityReleaseCallback(const void *info) { failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure { AFHTTPRequestOperation *operation = nil; - NSString *className = nil; - NSEnumerator *enumerator = [self.registeredHTTPOperationClassNames reverseObjectEnumerator]; - while (!operation && (className = [enumerator nextObject])) { + + for (NSString * className in self.registeredHTTPOperationClassNames) { Class op_class = NSClassFromString(className); if (op_class && [op_class canProcessRequest:urlRequest]) { operation = [(AFHTTPRequestOperation *)[op_class alloc] initWithRequest:urlRequest]; + break; } }