1

I have already asked few questions regarding my problem but could not reached to any solution.

Unable to load html string in UIWebView using loadHTMLString, It is showing a white page

How to fix "nsurlconnection finished with error - code 1100 " error for UIWebView in IOS?

Right now, I am facing a peculiar situation for the above problem. I download the files from the server to my local directory then load the files from a HTML string. Right now, I am able to load the same files from the same server in android but the same is not loading in iOS(blank screen)

Also if I download the files from other server then it is working fine in IOS.

So could anybody please give any suggestion on , why the files from other server is working but not from our server and if files from our server have issue then why it is working in android but in iOS ?

Below is the code used to load the html string(which is build from a template),Also I can switch to wkwebview if wanted.

if let data = readDataAsset(assetName: "start-template.html") {
            if let dataString = String(data: data, encoding: .utf8) {
                let occurrences = [
                    "{{playerPath}}": documentDirectory.path,
                    "{{lessonPath}}": lessonURL.path,
                    "{{viewType}}": viewType,
                    "{{state}}": state,
                    "{{pages}}": pages,
                    "{{pageNumber}}": startPageNumber]
                let html = dataString.replacingOccurrences(occurrences: occurrences)

                if useUIWebView {
                    webView.loadHTMLString(html, baseURL: documentDirectory)
                    webView.scalesPageToFit = true
                } else {
                    webKit.loadHTMLString(html, baseURL: documentDirectory)
                }
            }
        }

When it try to load from html string, it loads several files(js files, css, xml files) at that time it gets NSURLconnetion error code -1100 error. I know 1100 means filedoesnotexist but all the files are there(compared with the files from other server files)

PLEASE DO NOT MARK IT DUPLICATE

Ben Rockey
  • 920
  • 6
  • 23
RR_Pradhan
  • 78
  • 12

0 Answers0