Last active
January 2, 2016 06:59
-
-
Save ToQoz/8267396 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// typedef void (^TQAPIHTTPRequestSuccessHandler)(AFHTTPRequestOperation *operation, id responseObject); | |
// typedef void (^TQAPIHTTPRequestFailureHandler)(AFHTTPRequestOperation *operation, NSError *error); | |
NSString *path = <#path#>; | |
NSDictionary *params = <#params#>; | |
// ↓ OR define custom type and use it. e.g. TQAPIHTTPRequestSuccessHandler successHandler = ... | |
void (^successHandler)(AFHTTPRequestOperation *operation, id responseObject) = ^(AFHTTPRequestOperation *operation, id responseObject) { | |
if (block) { block(responseObject, nil); } | |
}; | |
// ↓ OR define custom type and use it. e.g. TQAPIHTTPRequestFailureHandler failureHandler = ... | |
void (^failureHandler)(AFHTTPRequestOperation *operation, NSError *error) = ^(AFHTTPRequestOperation *operation, NSError *error) { | |
if (block) { block(nil, error); } | |
}; | |
[self <#httpMethod#>Path:path | |
parameters:params | |
success:successHandler | |
failure:failureHandler]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment