title: UIWebview.loadURL() but URL is a self-signed certificate. Swift iOS
body: <p>I have a URL <a href="https://203.xxx.xxx.xxx" rel="nofollow">https://203.xxx.xxx.xxx</a>. This URL is used for our <strong><em>Testing purposes only</em></strong>.</p>
  
  <p>I want to load this URL in UIWebview in Swift2.0. But alas ! the certificate is expired.</p>
  
  <p>I did the same successfully in Android, but having issues in Swift.</p>
  
  <p>Please guide.....</p>
  
  <hr>
  
  <p><strong>What did i do till now !!</strong></p>
  
  <hr>
  
  <pre><code>01. Defined AppTransportSecurity in info.plist
  
      &lt;key&gt;NSAppTransportSecurity&lt;/key&gt;
              &lt;dict&gt;
                  &lt;key&gt;NSAllowsArbitraryLoads&lt;/key&gt;
                  &lt;true/&gt;
              &lt;/dict&gt;
  </code></pre>
  
  <ol start="2">
  <li>Tried using connection(canAuthenticateAgainstProtectionSpace) &amp; connection(willSendRequestForAuthenticationChallenge)</li>
  </ol>
  
  <p>But didn't succeed.</p>
  
  <hr>
  
  <p><strong>What happens when i load the same URL in Safari ??</strong></p>
  
  <hr>
  
  <p>Error says : <a href="http://i.stack.imgur.com/wDNoU.png" rel="nofollow">Safari cannot verify the IDENTITY</a></p>
  
  <p>Need help in bypassing this.</p>
  
  <hr>
  
  <p><strong>Also tried some links</strong> : (This could be the solution)</p>
  
  <pre><code>@implementation NSURLRequest (NSURLRequestWithIgnoreSSL) 
  
  + (BOOL)allowsAnyHTTPSCertificateForHost:(NSString *)host
  {
      return YES;
  }
  
  @end
  </code></pre>
  
  <p>But how to implement this in Swift 2.0 ?
  If i am wrong please guide correctly in Swift.</p>