0

I'm trying to create a UIWebView in objective-c . I get deprecation error so I tried to use recommended webkit WkWebview but at a point I still get error here

- (void)webViewDidFinishLoad:(UIWebView *)webView{

}

I have tried using it this way but yet get new error Implementing deprecated method

- (void)webViewDidFinishLoad:(WKWebView *)webView{

}
Teja Nandamuri
  • 11,045
  • 6
  • 57
  • 109
Peter
  • 1,860
  • 2
  • 18
  • 47

2 Answers2

1

The WKWebView version of webViewDidFinishLoad is this: (in Objective-C syntax)

- (void)webView:(WKWebView *)webView 
didFinishNavigation:(WKNavigation *)navigation {

}
Michael Dougan
  • 1,698
  • 1
  • 9
  • 13
  • Please is there a place I can fine all the methods that change in webkit? like `- (void)webViewDidStartLoad` etc – Peter May 14 '19 at 07:45
  • This answer has a few of them: https://stackoverflow.com/questions/26128815/uiwebview-delegate-method-shouldstartloadwithrequest-equivalent-in-wkwebview – Michael Dougan May 14 '19 at 15:35
0

Replacing the UIWebView name with WKWebView on the delegate method webViewDidFinishLoad doesn't work as it is the delegate method for UIWebView. You need to use the original delegate method for WKWebView.

As per documentation, you should use

func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!)

instead of

- (void)webViewDidFinishLoad:(UIWebView *)webView{

}

On migrating to WKWebView you can refer this

Teja Nandamuri
  • 11,045
  • 6
  • 57
  • 109