UIWebView capturing the response headers

前端 未结 4 966
耶瑟儿~
耶瑟儿~ 2020-12-05 08:29

I searched/googled a lot but could not get the answer on how to capture HTTP response headers in UIWebview. Say I redirect to user to registration gateway(which

4条回答
  •  温柔的废话
    2020-12-05 09:11

    NSHTTPURLResponse has method like

    - (NSDictionary *)allHeaderFields
    

    For more info https://developer.apple.com/library/ios/#documentation/Cocoa/Reference/Foundation/Classes/NSHTTPURLResponse_Class/Reference/Reference.html#//apple_ref/occ/cl/NSHTTPURLResponse

    EDIT: Sorry I did not think about UIWebView. My solution works if you use NSURLConnection

    But if you feed you webview with a NSURLConnection then you have the chance to capture the connection including response headers.

提交回复
热议问题