mardi 2 janvier 2018

webViewDidFinishLoad() does not appear to be running in Swift

I have a view controller for a webview, setup through KINWebBrowser.

I've tried several ways to get these methods to execute:

func webViewDidStartLoad(webView: UIWebView) {
    print("Strat Loading")
}
func webViewDidFinishLoad(webView: UIWebView) {
    print("Finish Loading")
}
func webView(webView: UIWebView, didFailLoadWithError error: NSError?) {
    print(error?.localizedDescription)
}
func webView(webView: UIWebView, shouldStartLoadWithRequest request: NSURLRequest, navigationType: UIWebViewNavigationType) -> Bool {
    return true
}

override func webViewDidFinishLoad(_ webView: UIWebView) {
    super.webViewDidFinishLoad(webView)
    print("Finish Loading 2")
}

But nothing seems to be working.

My class definition seems normal: class WebBrowserViewController: KINWebBrowserViewController, NavigationProtocol {

But no matter what I do - override func or not, no logger or print statement I put in these functions seems to be executed.

What am I doing wrong? I am trying to create an event that will listen to when all of the web content is loaded so I can stop having a loading spinner appear.




Aucun commentaire:

Enregistrer un commentaire