webView:decidePolicyForNavigationAction:decisionHandler: -- decisionHandler cannot be called asynchronously

The documentation of decidePolicyForNavigationAction clearly states that the decisionHandler may be called asynchronously:

From the docs:

If you implement this method, always execute the decisionHandler block at some point. You may execute it synchronously from your delegate method’s implementation, or execute it asynchronously after your method returns.

If it is executed asynchronously, an error is always thrown:

'NSInternalInconsistencyException' reason: 'Completion handler passed to -[ViewController webView:decidePolicyForNavigationAction:decisionHandler:] was not called'

Is this a bug? Is there a workaround?

No, this is a developer error on your part. You must call the completion handler, passing it a value before the function returns. Please provide a copy of you're calling the handler.

webView:decidePolicyForNavigationAction:decisionHandler: -- decisionHandler cannot be called asynchronously
 
 
Q