earl
earl

Reputation: 31

Handling timeouts in Webview

Suppose you have a webview that would load a page, how would you handle the situation if the page fails to load, for instance, in 20 seconds?

More specifically which WebView delegate method is called when the such situation occurs?

- (void)webView:(WebView *)sender didFailProvisionalLoadWithError:(NSError *)error forFrame:(WebFrame *)frame

or

- (void)webView:(WebView *)sender didFailLoadWithError:(NSError *)error forFrame:(WebFrame *)frame

Upvotes: 0

Views: 942

Answers (1)

ariel
ariel

Reputation: 143

The distinction pointed out by Michael is important. In any case, if you register as a delegate for the UIWebView, you might end receiving the – webView:didFailLoadWithError: call. Here you can produce an UIAlertView with the error, or inject some pre-canned html or another view. It greatly depends on what you want to show.

Upvotes: 2

Related Questions