is there no way to catch "Received an unexpected URL from..."?

I'm attempting to rewrite an objective-c app using a UIWebViewsin Swift using a WKWebView.

The application displays a lot of local content.

While I can display the initial webpage in WKWebView with no problem. When I click on a link that points to more local content I get the following error:


Received an unexpected URL from the web process: "..."


The content uses a nonstandard href to identify the local content. Using the UIWebView shouldStartLoadWithRequest api I was able to intercept this clicked linked and rewrite the href in a way that I could load the appropriate local content.


So far I haven't been able to identify anything in WKWebView that would allow me to accomplish the same thing.

I'm consuming this content, not creating it so I don't have the option of changing the format of the href.


I've tried:


decidePolicyFor navigationResponse

decidePolicyFor navigationAction

didFail navigation

didFailProvisionalNavigation navigation

didStartProvisionalNavigation navigation


I tried adding a custom URLSchemeHandler...

nothing allowed me to intercept the link.


Instead in the console I get errors:


Received an unexpected URL from the web process:

Received an invalid message "WebPageProxy.DecidePolicyForNavigationAction" from the web process.

Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified service

It DO get decideActionPolicyFor: <WKNavigationActioncalls if I slightly rewrite the href... and I guess I could come up with a way to automatically rewrite all of these before the content is displayed in the WKWebView, but I guess I'm a little shocked that there's no way for me to catch these errors and handle them more gracefully.

Am I missing something?

Any help would be greatly appreciated!

Morgan Jones