1
votes

I'm a complete noob to objective c, so please excuse the dumb question.

I've been able to send post and get requests using AFHTTPRequestOperationManager following the guides for AFNetworking 2.0.

I started to look into response caching and from what I could read, AFHTTPRequestOperation has setCachePolicy. I started to switch all my calls to AFHTTPRequestOperation, but I'm finding it difficult to work with.

Am I creating unnecessary work for myself? If the server's cache headers are set correctly, do I need to do anything on the client side with AFNetworking?

With AFHTTPRequestOperationManager:

AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];

[manager POST:urlString parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) {

With AFHTTPRequestOperation:

AFHTTPRequestOperation *op = [[AFHTTPRequestOperation alloc] initWithRequest:request];
op.responseSerializer = [AFJSONResponseSerializer serializer];
[op setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {

I really hope this makes sense...

1

1 Answers

1
votes

AFHTTPRequestOperation is a subclass of AFURLConnectionOperation for requests using the HTTP or HTTPS protocols. It encapsulates the concept of acceptable status codes and content types, which determine the success or failure of a request.

AFHTTPRequestOperationManager encapsulates the common patterns of communicating with an web application over HTTP, including request creation, response serialization, network reachability monitoring, and security, as well as request operation management.