title: How to do authentication in UIWebView properly?
body: <p>I would like to support HTTP Basic Authentication in my UIWebView. </p>
  
  <p>At the moment, I am canceling requests in </p>
  
  <p><code>webView:shouldStartLoadWithRequest:navigationType:</code> then handle them in my own NSURLConnectionDelegate to check for and provide credentials if needed. I then use <code>loadData:MIMEType:textEncodingName:baseURL:</code> to present HTML in the web view. That works fine for any URLs that are passed to the delegate.</p>
  
  <p>My problem is that the delegate is never called for embedded elements, like images, JavaScript or CSS files. So if I have an HTML page which references an image which is protected with basic authentication, that image cannot be loaded properly. Additionally, <code>webView:didFinishLoad:</code> is never called, because the web view could not fully load the page. </p>
  
  <p>I have checked that case with Terra, a third-party browser available on the App Store, and it can fully cope with that situation. I think it would be possible to solve this by providing my own NSURLProtocol, but that seems too complicated. What am I missing?</p>