Moved nil'ing the connection until after the delegate is called
This commit is contained in:
parent
68e13764af
commit
1bab351997
1 changed files with 2 additions and 1 deletions
|
|
@ -351,11 +351,12 @@ static inline BOOL AFStateTransitionIsValid(AFOperationState fromState, AFOperat
|
||||||
- (void)cancelConnection {
|
- (void)cancelConnection {
|
||||||
if (self.connection) {
|
if (self.connection) {
|
||||||
[self.connection cancel];
|
[self.connection cancel];
|
||||||
self.connection = nil;
|
|
||||||
|
|
||||||
// Manually send this delegate message since `[self.connection cancel]` causes the connection to never send another message to its delegate
|
// Manually send this delegate message since `[self.connection cancel]` causes the connection to never send another message to its delegate
|
||||||
NSDictionary *userInfo = [NSDictionary dictionaryWithObject:[self.request URL] forKey:NSURLErrorFailingURLErrorKey];
|
NSDictionary *userInfo = [NSDictionary dictionaryWithObject:[self.request URL] forKey:NSURLErrorFailingURLErrorKey];
|
||||||
[self performSelector:@selector(connection:didFailWithError:) withObject:self.connection withObject:[NSError errorWithDomain:NSURLErrorDomain code:NSURLErrorCancelled userInfo:userInfo]];
|
[self performSelector:@selector(connection:didFailWithError:) withObject:self.connection withObject:[NSError errorWithDomain:NSURLErrorDomain code:NSURLErrorCancelled userInfo:userInfo]];
|
||||||
|
|
||||||
|
self.connection = nil;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue