iOS 5 UIWebview Delegate: WebKit discarded an uncaught exception in the webView:decidePolicyForNavigationAction

前端 未结 5 791
借酒劲吻你
借酒劲吻你 2020-12-16 22:38

I am using the delegate method shouldStartLoadWithRequest to catch link clicks and handle specific cases inside my app instead of allowing the webView

5条回答
  •  南笙
    南笙 (楼主)
    2020-12-16 22:55

    Check out if you nullify delegate property of UIWebView in its controller dealloc method (of course if this controller is webview's delegate). Like this:

    - (void) viewDidLoad
    {
        webView.delegate = self;
    }
    - (void) dealloc
    {
        webView.delegate = nil;
    }
    

    From the Apple docs on the delegate property:

    Important. Before releasing an instance of UIWebView for which you have set a delegate, you must first set its delegate property to nil. This can be done, for example, in your dealloc method.

提交回复
热议问题