Objective c 没有http头
我正在尝试查找http头,但我认为我的方法不起作用。 我正在使用Objective c 没有http头,objective-c,xcode,http,uiwebview,nslog,Objective C,Xcode,Http,Uiwebview,Nslog,我正在尝试查找http头,但我认为我的方法不起作用。 我正在使用 - (BOOL)webView:(UIWebView *)webView2 shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType { NSMutableURLRequest *req = (NSMutableURLRequest *)request; NSLog(@"u
- (BOOL)webView:(UIWebView *)webView2 shouldStartLoadWithRequest:(NSURLRequest *)request
navigationType:(UIWebViewNavigationType)navigationType {
NSMutableURLRequest *req = (NSMutableURLRequest *)request;
NSLog(@"user agent = %@", [req valueForHTTPHeaderField: @"User-Agent"]);
NSLog(@"http headers = %@", [request allHTTPHeaderFields]);
NSLog(@"http headers = %@", [req allHTTPHeaderFields]);
}
但是NSLog正在打印出来
http headers = {
req和request都不是零。有人知道我为什么无法获取标题吗
谢谢
克林顿(Clinton)出于好奇,当你试图打印一本词典时会发生什么?只是想知道,既然所有HttpHeaderFields返回的只是NSDictionary*dic=[NSDictionary Dictionary dictionaryWithContentsOfURL:[NSURL URLWithString:@http://www.google.ca]]; NSLog@dic=%@,dic;它返回为dic=null