I\'ve just started using AFNetworking 2.0 and I was wondering how I put in headers into a HTTP Get request. The documentation sets up a GET like this:
AFHTTP
Here's what i believe to be a best option. In a singleton somewhere, configure an AFHTTPSessionManager using an NSURLSessionConfiguration, and then use that AFHTTPSessionManager every time you want to make a request.
NSURLSessionConfiguration *config = [NSURLSessionConfiguration defaultSessionConfiguration];
config.HTTPAdditionalHeaders = @{@"Accepts": @"application/json"};
mySingletonSessionManager = [[AFHTTPSessionManager alloc] initWithBaseURL:[NSURL URLWithString:kMyBaseUrl] sessionConfiguration:config];