Get UIWebView response header

后端 未结 5 1183
广开言路
广开言路 2021-01-05 07:57

I have looked into ways to get response header from UIWebview response. This SO question discusses it. But I am unsure if this is allowed by apple. I will have a webview sho

5条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-05 08:03

    This should do it for you.

    - (void)webViewDidFinishLoad:(UIWebView *)webView {
        NSCachedURLResponse *resp = [[NSURLCache sharedURLCache] cachedResponseForRequest:webView.request];
        NSLog(@"%@",[(NSHTTPURLResponse*)resp.response allHeaderFields]);
    }
    

提交回复
热议问题