0

I have a https request sent to a server, now I want to access the response (NSURLResponse) in webViewDidFinishLoad. How do I access that?

didReceiveResponse is used for handling https part, so I can't really use that response there yet.

My current method of didReceiveResponse looks like below

-(void) connection:(NSURLConnection *) connection didReceiveResponse:(NSURLResponse *)response
{
   _authenticated = YES;
   [myWebView loadRequest:req];

   [con cancel];

}
yogsma
  • 10,142
  • 31
  • 97
  • 154
  • 1
    A quick skim of google seems to say that there's no direct way, but apparently, the web view caches response -- keyed by the request -- in the NSURLCache sharedURLCache. e.g. see this probable duplicate http://stackoverflow.com/questions/22325818/get-uiwebview-response-header – danh Mar 18 '15 at 17:51
  • @danh - it is only applicable for cacheable URLs – yogsma Mar 18 '15 at 20:30

1 Answers1

0

I think you could intercept the requests in shouldStartLoadWithRequest https://stackoverflow.com/a/22792754/445887 seems to be a valid answer

Community
  • 1
  • 1
Tom Roggero
  • 5,777
  • 1
  • 32
  • 39