I’m using AFNetworking library, and it works using blocks to handle your results, like as follow:
[httpClient HTTPRequestOperationWithRequest:request success:^(AFHTTPRequestOperation *op, id response) {
//success clock
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
//error block
}]
have a way of use it without code blocks? for example using a delegate? something like as follow:
[httpClient HTTPRequestOperationWithRequest:request delegate:self]
and in self class:
-(void)afhttpSuccess:(AFHTTPRequestOperation*)op Response:(id)response {
//success method
}
-(void)afhttpError:(AFHTTPRequestOperation*)op Response:(NSError*)error {
//error method
}
Not sure why a delegate + selector paradigm would be preferable, but I made this library, which eases the transition from ASI, which has that pattern.
Alternatively, you can always just call the success / failure methods in your success/failure callbacks.