From 29c1650e1295b48050cae8383457acb1f99e06e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9=20=D0=9A=D1=83?= =?UTF-8?q?=D1=80=D1=82=D0=B5=D0=B5=D0=B2?= Date: Thu, 26 Jun 2014 16:19:15 +0400 Subject: [PATCH] More changes --- AFAbstractRESTClient/AbstractGETAPICall.h | 2 +- AFAbstractRESTClient/AbstractGETAPICall.m | 4 ++-- AFAbstractRESTClient/AbstractPOSTAPICall.h | 2 +- AFAbstractRESTClient/AbstractPOSTAPICall.m | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/AFAbstractRESTClient/AbstractGETAPICall.h b/AFAbstractRESTClient/AbstractGETAPICall.h index 51fa26a..dba407b 100644 --- a/AFAbstractRESTClient/AbstractGETAPICall.h +++ b/AFAbstractRESTClient/AbstractGETAPICall.h @@ -10,6 +10,6 @@ @interface AbstractGETAPICall : NSObject -- (void) executeAPICallWithSuccessBlock:(void (^)(NSHTTPURLResponse *response, id responseObject)) blockSuccess failure:(void (^)(NSError *error, id responseObject)) blockFailure; +- (void) executeAPICallWithSuccessBlock:(void (^)(NSHTTPURLResponse *response, id responseObject)) blockSuccess failure:(void (^)(NSError *error, NSHTTPURLResponse *response, id responseObject)) blockFailure; @end diff --git a/AFAbstractRESTClient/AbstractGETAPICall.m b/AFAbstractRESTClient/AbstractGETAPICall.m index f589a24..a88f0ea 100644 --- a/AFAbstractRESTClient/AbstractGETAPICall.m +++ b/AFAbstractRESTClient/AbstractGETAPICall.m @@ -12,7 +12,7 @@ @implementation AbstractGETAPICall -- (void) executeAPICallWithSuccessBlock:(void (^)(NSHTTPURLResponse *response, id responseObject)) blockSuccess failure:(void (^)(NSError *error, id responseObject)) blockFailure { +- (void) executeAPICallWithSuccessBlock:(void (^)(NSHTTPURLResponse *response, id responseObject)) blockSuccess failure:(void (^)(NSError *error, NSHTTPURLResponse *response, id responseObject)) blockFailure { NETWORK_ON; NSDictionary *params = [self queryParams]; @@ -38,7 +38,7 @@ - (void) executeAPICallWithSuccessBlock:(void (^)(NSHTTPURLResponse *response, i NSLog(@"executeAPICall FAILURE body: %@\n\n", [[NSString alloc] initWithData:request.HTTPBody encoding:NSUTF8StringEncoding]); NSLog(@"executeAPICall FAILURE error: %@\n",error); - if (blockFailure != nil) blockFailure(error, JSON); + if (blockFailure != nil) blockFailure(error, response, JSON); NETWORK_OFF; diff --git a/AFAbstractRESTClient/AbstractPOSTAPICall.h b/AFAbstractRESTClient/AbstractPOSTAPICall.h index d567e1e..bf50ccd 100644 --- a/AFAbstractRESTClient/AbstractPOSTAPICall.h +++ b/AFAbstractRESTClient/AbstractPOSTAPICall.h @@ -13,6 +13,6 @@ extern NSString *const kServerURLString; @interface AbstractPOSTAPICall : NSObject -- (void) executeAPICallWithSuccessBlock:(void (^)(NSHTTPURLResponse *response, id responseObject)) blockSuccess failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) blockFailure progress: (void (^)(long long totalBytesWritten, long long totalBytesExpectedToWrite)) blockProgress; +- (void) executeAPICallWithSuccessBlock:(void (^)(NSHTTPURLResponse *response, id responseObject)) blockSuccess failure:(void (^)(AFHTTPRequestOperation *operation, NSHTTPURLResponse *response, NSError *error)) blockFailure progress: (void (^)(long long totalBytesWritten, long long totalBytesExpectedToWrite)) blockProgress; @end diff --git a/AFAbstractRESTClient/AbstractPOSTAPICall.m b/AFAbstractRESTClient/AbstractPOSTAPICall.m index c2d5453..f9cfe06 100644 --- a/AFAbstractRESTClient/AbstractPOSTAPICall.m +++ b/AFAbstractRESTClient/AbstractPOSTAPICall.m @@ -13,7 +13,7 @@ @implementation AbstractPOSTAPICall -- (void) executeAPICallWithSuccessBlock:(void (^)(NSHTTPURLResponse *response, id responseObject)) blockSuccess failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) blockFailure progress: (void (^)(long long totalBytesWritten, long long totalBytesExpectedToWrite)) blockProgress { +- (void) executeAPICallWithSuccessBlock:(void (^)(NSHTTPURLResponse *response, id responseObject)) blockSuccess failure:(void (^)(AFHTTPRequestOperation *operation, NSHTTPURLResponse *response, NSError *error)) blockFailure progress: (void (^)(long long totalBytesWritten, long long totalBytesExpectedToWrite)) blockProgress { NETWORK_ON; AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL:[NSURL URLWithString:kServerURLString]]; @@ -52,7 +52,7 @@ - (void) executeAPICallWithSuccessBlock:(void (^)(NSHTTPURLResponse *response, i NSLog(@"executeAPICall FAILURE body: %@\n\n", [[NSString alloc] initWithData:request.HTTPBody encoding:NSUTF8StringEncoding]); NSLog(@"executeAPICall FAILURE error: %@\n",error); - if (blockFailure) blockFailure(operation, error); + if (blockFailure) blockFailure(operation, [operation response], error); NETWORK_OFF;