Swift - UIWebView baseURL resulting in blank screen
<p>I need to show a web browser in my app. I can't use SFSafariViewController as I need to be able to authenticate with NTLM, so I'm currently using Alamofire to download the <code>data</code> and then displaying it in a UIWebView.</p>

<p>I have got the UIWebView to display the HTML via <code>.loadHTMLString()</code>, however the images, CSS and Javascript files are not loading. I tried setting the <code>baseURL</code> to the website root, however, when I do this nothing at all loads in the <code>UIWebView</code>, leaving it blank with no content or errors in the console.</p>

<pre><code>Alamofire.request(.GET, "https://dev-moss.stpaulscatholiccollege.co.uk/sites/Students/default.aspx").authenticate(usingCredential: credential)
    .response { request, response, data, error in

        dispatch_async(dispatch_get_main_queue(), { () -&gt; Void in

            // check for errors or bad responsecode
            if (error == nil) &amp;&amp; (response?.statusCode == 200) {
                // load the website
                let gatewayString = "\(NSString(data: data!, encoding: NSUTF8StringEncoding))"

                self.gatewayWebView.loadHTMLString(String(NSString(data: data!, encoding: NSUTF8StringEncoding)!), baseURL: nil)
                print(gatewayString)

            }
            else {
                print("There was an error loading the website.")
            }

        })

}
</code></pre>

<p>Even when setting the <code>baseURL</code> to <code>NSURL(string: "https://dev-moss.stpaulscatholiccollege.co.uk/")</code> or <code>NSURL(string: "https://dev-moss.stpaulscatholiccollege.co.uk")</code> the <code>print</code> of <code>gatewayString</code> still spits out the website to the console however.</p>