Ios - UIWebView DidFinishLoad not called

I have UIWebViewone that works fine. The delegate is working. When I open the URL, events are triggered shouldStartLoadWithRequestand webViewDidFinishLoad.

But when, for example, I click on a Google search result, it only starts shouldStartLoadWithRequest, but webViewDidFinishLoadnever gets called.

This causes problems because if I put the “load ...” indicator on shouldStartLoadWithRequest, in these cases the indicator still remains even after the page loads correctly.

Any idea why this is happening?

+5
source share
4 answers

Not an expert on the Google API, but, as I suspected, this could be the reason.

0
source

.h <UIWebViewDelegate>

.m:

yourWebview=[[UIWebView alloc]init];
yourWebview.delegate=self;
+1

navigationType UIWebViewNavigationTypeFormSubmitted. . , webViewDidFinishLoad .

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
    NSLog(@"shouldStartLoadWithRequest");

    if ( navigationType == UIWebViewNavigationTypeLinkClicked ){
        NSLog(@"UIWebViewNavigationTypeLinkClicked");

        return YES;
    } 
    if (navigationType ==UIWebViewNavigationTypeFormSubmitted ) {
        NSLog(@"UIWebViewNavigationTypeFormSubmitted");
        return YES;
    }
    if (navigationType ==UIWebViewNavigationTypeBackForward) {
        NSLog(@"UIWebViewNavigationTypeBackForward");
        return YES;
    }
    if (navigationType ==UIWebViewNavigationTypeFormResubmitted) {
        NSLog(@"UIWebViewNavigationTypeFormResubmitted");
        return YES;
    }
    if (navigationType ==UIWebViewNavigationTypeReload) {
        NSLog(@"UIWebViewNavigationTypeReload");
        return YES;
    }



    return YES;
}
+1

ipad.... , [self performselector: afterdelay], , - , [m_pWebview ]; ... , ........

+1

All Articles