iOS UIWebView crash in “WebThread”

前端 未结 3 1878
长情又很酷
长情又很酷 2020-12-09 22:23

Anyone able to help me out with this crash? It happens intermittently when switching back and forth between some UIWebView instances while they are loading.

The cra

3条回答
  •  生来不讨喜
    2020-12-09 23:02

    To expand on @K1w1Geek's answer, the problem may be that the user is closing the web view just before it tries to send a delegate callback and it crashes because it doesn't exist. This doesn't necessarily have to be related to loading a particular document type because I'm experiencing this crash just navigating a Salesforce website.

    So if you have a close button, try to stop loading and set the delegate to nil before closing:

    - (IBAction)btnCloseWebviewTap:(id)sender{
        [_webView stopLoading];
        _webView.delegate = nil;
        [self dismissViewControllerAnimated:YES completion:nil];
    }
    

提交回复
热议问题