0

I've subclassed AFHTTPSessionManager as encouraged by the docs. When I do a POST, like so:

[[ABHTTPSessionManager sharedManager] POST:@"/api/foo" parameters:@{@"foo": @"bar"} success:^(NSURLSessionDataTask *task, id responseObject) {
    // handle success
} failure:^(NSURLSessionDataTask *task, NSError *error) {
    // handle failure
}];

In the failure block I'd like to access the body of the response. Is the only way to do this to write a custom response serializer?

Community
  • 1
  • 1
apb
  • 3,270
  • 3
  • 29
  • 23

1 Answers1

0

After more digging it looks like the definitive answer from the creator of AFNetworking is that yes, creating a custom response serializer is the correct approach. (Though that's almost two years dated).

EDIT

Nope! No need to subclass. I used the approach outlined here. This question should probably be closed as a duplicate.

Community
  • 1
  • 1
apb
  • 3,270
  • 3
  • 29
  • 23