ios – In webView results in crash and UI unresponsiveness

[ad_1]

I Have added webView load html and baseUrl technique. However it results in crash the app and exhibiting warning

This technique shouldn’t be known as on the principle thread as it might result in
UI unresponsiveness.

 //load HTML
                            let htmlPath = Bundle.principal.path(forResource: "index", ofType: "html")
                            let folderPath = Bundle.principal.bundlePath
                            let baseUrl = URL(fileURLWithPath: folderPath, isDirectory: true)
                            do {
                                let htmlString = attempt NSString(contentsOfFile: htmlPath!, encoding: String.Encoding.utf8.rawValue)
                                self.webView.loadHTMLString(htmlString as String, baseURL: URL(string: newBaseURL))
                            } catch {
                                // catch error
                                print(error.localizedDescription)
                            }

I’ve known as this viewDidLoad(). Any assist a lot appreciated please…

[ad_2]

Leave a Reply