I have an UIWebView in my iOS app, which displays a very long web page. If the page fails to load for some reason, I display an alert in my webView:didFailLoadWithError: method. However, it is possible that user would tap some link BEFORE the page is fully loaded, and UIWebView treats that as an error as well, which I want to ignore silently. Is there any way to find out that a page loading error originates from user tapping a link?
Tell me more
×
Stack Overflow is a question and answer site for
professional and enthusiast programmers. It's 100% free, no registration required.
As user1135469 suggested, error.code seems to be the key. It's NSURLErrorCancelled when the user taps the link, and it's safe to just ignore this error code. |
|||
|
webViewDidFinishLoad:
? – user1135469 20 hours agowebView:didFailLoadWithError:
errors. I suspect that the error code for the "tap link before page is fully loaded" would be different to the others so just useif([error code] == {figure out what the code is for that case by NSLog(@"error: %@")}) return;
– user1135469 18 hours ago