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爲空。我錯過了什麼?