开发者

Handling timeouts in Webview

开发者 https://www.devze.com 2022-12-09 19:56 出处:网络
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?

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

精彩评论

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

关注公众号