Merge branch 'master' of https://github.com/danielctull/AFNetworking
This commit is contained in:
commit
d933067eb4
6 changed files with 11 additions and 28 deletions
|
|
@ -273,10 +273,6 @@ static void AFSwizzleClassMethodWithClassAndSelectorUsingBlock(Class klass, SEL
|
||||||
#pragma clang diagnostic push
|
#pragma clang diagnostic push
|
||||||
#pragma clang diagnostic ignored "-Warc-retain-cycles"
|
#pragma clang diagnostic ignored "-Warc-retain-cycles"
|
||||||
self.completionBlock = ^{
|
self.completionBlock = ^{
|
||||||
if ([self isCancelled]) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (self.error) {
|
if (self.error) {
|
||||||
if (failure) {
|
if (failure) {
|
||||||
dispatch_async(self.failureCallbackQueue ?: dispatch_get_main_queue(), ^{
|
dispatch_async(self.failureCallbackQueue ?: dispatch_get_main_queue(), ^{
|
||||||
|
|
|
||||||
|
|
@ -203,10 +203,6 @@ static dispatch_queue_t image_request_operation_processing_queue() {
|
||||||
#pragma clang diagnostic push
|
#pragma clang diagnostic push
|
||||||
#pragma clang diagnostic ignored "-Warc-retain-cycles"
|
#pragma clang diagnostic ignored "-Warc-retain-cycles"
|
||||||
self.completionBlock = ^ {
|
self.completionBlock = ^ {
|
||||||
if ([self isCancelled]) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
dispatch_async(image_request_operation_processing_queue(), ^(void) {
|
dispatch_async(image_request_operation_processing_queue(), ^(void) {
|
||||||
if (self.error) {
|
if (self.error) {
|
||||||
if (failure) {
|
if (failure) {
|
||||||
|
|
|
||||||
|
|
@ -104,11 +104,7 @@ static dispatch_queue_t json_request_operation_processing_queue() {
|
||||||
{
|
{
|
||||||
#pragma clang diagnostic push
|
#pragma clang diagnostic push
|
||||||
#pragma clang diagnostic ignored "-Warc-retain-cycles"
|
#pragma clang diagnostic ignored "-Warc-retain-cycles"
|
||||||
self.completionBlock = ^ {
|
self.completionBlock = ^ {
|
||||||
if ([self isCancelled]) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (self.error) {
|
if (self.error) {
|
||||||
if (failure) {
|
if (failure) {
|
||||||
dispatch_async(self.failureCallbackQueue ?: dispatch_get_main_queue(), ^{
|
dispatch_async(self.failureCallbackQueue ?: dispatch_get_main_queue(), ^{
|
||||||
|
|
|
||||||
|
|
@ -108,11 +108,7 @@ static dispatch_queue_t property_list_request_operation_processing_queue() {
|
||||||
{
|
{
|
||||||
#pragma clang diagnostic push
|
#pragma clang diagnostic push
|
||||||
#pragma clang diagnostic ignored "-Warc-retain-cycles"
|
#pragma clang diagnostic ignored "-Warc-retain-cycles"
|
||||||
self.completionBlock = ^ {
|
self.completionBlock = ^ {
|
||||||
if ([self isCancelled]) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (self.error) {
|
if (self.error) {
|
||||||
if (failure) {
|
if (failure) {
|
||||||
dispatch_async(self.failureCallbackQueue ?: dispatch_get_main_queue(), ^{
|
dispatch_async(self.failureCallbackQueue ?: dispatch_get_main_queue(), ^{
|
||||||
|
|
|
||||||
|
|
@ -471,15 +471,18 @@ static inline BOOL AFStateTransitionIsValid(AFOperationState fromState, AFOperat
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)cancelConnection {
|
- (void)cancelConnection {
|
||||||
|
|
||||||
|
NSDictionary *userInfo = nil;
|
||||||
|
if ([self.request URL]) {
|
||||||
|
userInfo = [NSDictionary dictionaryWithObject:[self.request URL] forKey:NSURLErrorFailingURLErrorKey];
|
||||||
|
}
|
||||||
|
self.error = [NSError errorWithDomain:NSURLErrorDomain code:NSURLErrorCancelled userInfo:userInfo];
|
||||||
|
|
||||||
if (self.connection) {
|
if (self.connection) {
|
||||||
[self.connection cancel];
|
[self.connection cancel];
|
||||||
|
|
||||||
// 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 = nil;
|
[self performSelector:@selector(connection:didFailWithError:) withObject:self.connection withObject:self.error];
|
||||||
if ([self.request URL]) {
|
|
||||||
userInfo = [NSDictionary dictionaryWithObject:[self.request URL] forKey:NSURLErrorFailingURLErrorKey];
|
|
||||||
}
|
|
||||||
[self performSelector:@selector(connection:didFailWithError:) withObject:self.connection withObject:[NSError errorWithDomain:NSURLErrorDomain code:NSURLErrorCancelled userInfo:userInfo]];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -140,11 +140,7 @@ static dispatch_queue_t xml_request_operation_processing_queue() {
|
||||||
{
|
{
|
||||||
#pragma clang diagnostic push
|
#pragma clang diagnostic push
|
||||||
#pragma clang diagnostic ignored "-Warc-retain-cycles"
|
#pragma clang diagnostic ignored "-Warc-retain-cycles"
|
||||||
self.completionBlock = ^ {
|
self.completionBlock = ^ {
|
||||||
if ([self isCancelled]) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
dispatch_async(xml_request_operation_processing_queue(), ^(void) {
|
dispatch_async(xml_request_operation_processing_queue(), ^(void) {
|
||||||
NSXMLParser *XMLParser = self.responseXMLParser;
|
NSXMLParser *XMLParser = self.responseXMLParser;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue