iOS UiWebView “Frame load interrupted”

后端 未结 1 1883
醉话见心
醉话见心 2021-01-17 05:18

I have a UiWebView that is pointing to an external site that has a session expiration of 30 minutes of inactivity. In my app, I have a custom login page embedded in the app

相关标签:
1条回答
  • 2021-01-17 05:40

    I think you will need to handle the file:// protocol in a UIWebView delegate method. eg.

    - (BOOL)webView:(UIWebView *)theWebView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
    {
       // Intercept the external http requests and forward to Safari.app
        // Otherwise forward to the PhoneGap WebView
        if ([[url scheme] isEqualToString:@"http"] || [[url scheme] isEqualToString:@"https"]) {
            [[UIApplication sharedApplication] openURL:url];
            return NO;
        }
        else {
            return [ super webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType ];
        }
    }
    

    In your case, tell the delegate method what to do with your url scheme. eg.

    if ([url.scheme isEqualToString:@"file"]) {
        NSLog(@"Open start page");
        [[UIApplication sharedApplication] openURL:url];
        return NO;
    }
    

    Not sure if this will work for you, but hopefully it will provide a path to the solution.

    0 讨论(0)
提交回复
热议问题