How can I read the data from the header sent by in the server response. I am using NSURLConnection to send the request.
In my case
NSHTTPURLResponse *response = ((NSHTTPURLResponse *)[task response]);
NSDictionary *headers = [response allHeaderFields];
Good Approach
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse*)[task response];
if ([httpResponse respondsToSelector:@selector(allHeaderFields)]) {
NSDictionary *dictionary = [httpResponse allHeaderFields];
NSLog(@"%@", [dictionary description]);
}