2
我想在每个请求的标头中传递API密钥。API密钥必须在每个请求中作为API密钥标头传递
NSMutableURLRequest* request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:url]];
NSLog(@"%@",request);
[request setHTTPMethod: @"POST"];
[request addValue:@"4eaa90d7175e98732543994eaa90d717" forHTTPHeaderField:@"API-Key"] ;
request = [NSURLRequest requestWithURL:[NSURL URLWithString:url] cachePolicy:
NSURLRequestUseProtocolCachePolicy timeoutInterval:100];
NSLog(@"%@",url);
NSLog(@"%@",[request allHTTPHeaderFields]);
allHTTPHeaderFields为空。我错过了什么?