The following commands work fine with the AFNetworking 1.x library
[self registerHTTPOperationClass:[AFJSONRequestOperation class]];
...
[self setDefaultHeader:@"Accept" value:@"application/json"];
What's the equivalent of these functions in AFNetworking 2.0 ?
Thanks
You can set header values on the instance of AFHTTPRequestSerializer
that is assigned to your AFHTTPSessionManager
(iOS 7) or AFHTTPRequestOperationManager
(iOS 6) instance. AFNetworking will use the header fields in the request serializer when it builds and executes your requests. You can also subclass AFHTTPRequestSerializer
to provide default behavior across all instances. See http://cocoadocs.org/docsets/AFNetworking/2.0.0/Classes/AFHTTPRequestSerializer.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With