0
Я использовал ниже код для получения полей ответа и заголовка.Невозможно получить поля заголовка из url
NSMutableURLRequest *NSRequest;
NSRequest = [[NSMutableURLRequest alloc] init];
[NSRequest setURL:[NSURL URLWithString:@"http://72.52.65.142:8083/auth"]];
[NSRequest setHTTPMethod:@"HEAD"];
[NSURLConnection sendAsynchronousRequest:NSRequest queue:[NSOperationQueue currentQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse*)response;
if ([response respondsToSelector:@selector(allHeaderFields)]) {
NSDictionary *dictionary = [httpResponse allHeaderFields];
NSLog(@"%@", dictionary);
}
}];
Но журналы, которые я получаю, являются нулевыми.
Как получить поля заголовка сверху запроса?
Попробуйте следующее http://stackoverflow.com/questions/4809047/nsurlrequest-setting-the-http-header – nynohu