开发者

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 de开发者_JAVA技巧legate 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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜