title: How to cancel a request made in a UIWebView?
body: <p>Due to an <a href="https://stackoverflow.com/questions/10628409/uiwebview-why-does-the-request-not-time-out-when-using-a-non-existant-hostname">issue</a> where I can't get the <code>NSURLRequest</code> timeout to fire in my <code>UIWebView</code>, I am trying to use an <code>NSTimer</code> to check to see if I've got a response within a designated period. If I haven't, then I want to cancel the request and warn the user.</p>
  
  <p>However: I'm unable to find a way to cancel a current request that has been made in a <code>UIWebView</code>.</p>
  
  <p>How do you do it?</p>
  
  <p>I have setup the request for the <code>UIWebView</code> as follows:</p>
  
  <pre><code>NSString *theURL = [NSString stringWithFormat:@"https://%@%@", _hostname, LOGIN_PART_URL];
  NSString *body = [NSString stringWithFormat:@"Username=%@&amp;Password=%@", _username, _password];
  
  NSMutableURLRequest *request = [[NSMutableURLRequest alloc]initWithURL:[NSURL URLWithString:theURL] 
                                                             cachePolicy:NSURLRequestUseProtocolCachePolicy
                                                         timeoutInterval:_timeoutInSecs];
  
  
  
  [request setHTTPMethod: @"POST"];
  [request setHTTPBody: [body dataUsingEncoding: NSUTF8StringEncoding]];
  
  [web loadRequest:request];
  </code></pre>
  
  <p>I can see that <code>NSURLConnection</code> has a cancel method, but there seems to be no equivalent for <code>UIWebView</code>.</p>
  
  <p>What am I missing?</p>
  
  <p>Thanks!
  Stretch :)</p>