Skip to content

Instantly share code, notes, and snippets.

@frontconnect
Last active December 31, 2015 05:29
Show Gist options
  • Save frontconnect/7941416 to your computer and use it in GitHub Desktop.
Save frontconnect/7941416 to your computer and use it in GitHub Desktop.
AFNetworking post wrapper
-(void) get:(NSString *)rest withParams:(NSDictionary*)params
completion:(void (^)(id))completionBlock
{
NSString *curUrl = [self.constant.url stringByAppendingString:rest];
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
[manager GET:curUrl parameters:params success:^(AFHTTPRequestOperation *operation, id responseObject) {
//success
NSLog(@"rest: %@, response: %@", rest ,responseObject);
completionBlock(responseObject);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"rest: %@, error: %@", rest, error);
}];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment