tags:

views:

109

answers:

1

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
+1  A: 

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.

ariel
The same also goes for WebView. You would run an NSAlert if the WebView fails to load its main resource.
Peter Hosey