From 9b1c1f285cba569abb7626d2fc9e115e9b837331 Mon Sep 17 00:00:00 2001 From: Mattt Thompson Date: Thu, 6 Oct 2011 10:15:58 -0500 Subject: [PATCH] Checking for cancellation early in -operationDidStart --- AFNetworking/AFURLConnectionOperation.m | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/AFNetworking/AFURLConnectionOperation.m b/AFNetworking/AFURLConnectionOperation.m index fcc7001..353a12e 100644 --- a/AFNetworking/AFURLConnectionOperation.m +++ b/AFNetworking/AFURLConnectionOperation.m @@ -271,6 +271,11 @@ static inline NSString * AFKeyPathFromOperationState(AFOperationState state) { } - (void)operationDidStart { + if ([self isCancelled]) { + [self finish]; + return; + } + self.connection = [[[NSURLConnection alloc] initWithRequest:self.request delegate:self startImmediately:NO] autorelease]; NSRunLoop *runLoop = [NSRunLoop currentRunLoop];