Note that there are some explanatory texts on larger screens.

plurals
  1. POIgnoring Invalid Server Certificates with UIWebView
    primarykey
    data
    text
    <p>We have an iOS app that uses a UIWebView to display content. We load it up with data with code that looks like this:</p> <pre><code>NSURL *url = [NSURL URLWithString:myURLString]; NSURLRequest *request = [NSURLRequest requestWithURL:url]; [_webView setDelegate:self]; [_webView loadRequest:request]; </code></pre> <p>This used to work fine with HTTP requests, but now we are using HTTPS against a server with a self-signed SSL certificate. When the above is run, the <code>webView:didFailLoadWithError:</code> delegate method gets called, with this error:</p> <blockquote> <p>The certificate for this server is invalid. You might be connecting to a server that is pretending to be "blah.blah.blah.com" which could put your confidential information at risk."</p> </blockquote> <p>I would like to simply ignore the invalid certificate and go on with the request, as one can do in Mobile Safari.</p> <p>I have seen how to work around this issue when using <code>NSURLConnection</code> (see <a href="https://stackoverflow.com/questions/4861103/https-request-on-old-iphone-3g">HTTPS request on old iphone 3g</a>, for example), but what can one do with a <code>UIWebView</code>?</p> <p>I imagine that I could rework the code so that it uses <code>NSURLConnection</code> to make the requests and then puts the results into the web view by calling its <code>loadHTMLString:baseURL:</code> method, but that's going to get complicated when the pages have images, CSS, JavaScript, and so on. Is there an easier way?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload