Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is didFailLoadWithError normally called after I return NO in the delegate function shouldStartLoadWithRequest?

I am seeing this behavior not documented in Apple's UIWebViewDelegate:

If I return NO to the delegate function

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {

This function is immediately called with the error 101 (This URL cannot be loaded.).

- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {

Since I explicitly cancelled the request, is it even normal for didFailLoadWithError to be invoked?

like image 628
futureelite7 Avatar asked Jan 19 '26 16:01

futureelite7


1 Answers

Update: UIWebView will NOT call didFailLoadWithError if you manually cancel the connection.

I've verified this with testing. The reason why didFailLoadWithError is for something else completely unrelated to UIWebView.

like image 99
futureelite7 Avatar answered Jan 21 '26 07:01

futureelite7



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!