title: Detect when WKWebview cannot handle a request
body: <p>I have the following code</p>
  
  <pre><code>NSURL *nsurl = [NSURL urlWithString:@"http://url.that.does.not.exist.com"];
  NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:nsurl];
  WKWebViewConfiguration *config = [WKWebViewConfiguration new];
  WKWebView *wv = [[WKWebView alloc] initWithFrame:[[UIScreen mainScreen] bounds] configuration:config];
  wv.navigationDelegate = self;
  </code></pre>
  
  <p>And the delegate:</p>
  
  <pre><code>- (void)webView:(WKWebView *)webView
       decidePolicyForNavigationResponse:(WKNavigationResponse *)navigationResponse
                         decisionHandler:(void (^)(WKNavigationResponsePolicy))decisionHandler {
  ...
  }
  </code></pre>
  
  <p>Works fine and I can catch errors when the could not be loaded (404, etc). But how do I catch the error when the <code>nsurl</code> was something WKWebView cannot even handle?</p>
  
  <p>For example:</p>
  
  <pre><code>NSURL *nsurl = [NSURL urlWithString:@"nacho"];
  </code></pre>
  
  <p>will lead to a blank page with no delegate method being called. How can I handle detect this error? (I have checked at this <a href="https://stackoverflow.com/questions/5370009/iphone-sdk-check-validity-of-urls-with-nsurl-not-working">iPhone SDK: Check validity of URLs with NSURL not working?</a> but I wonder if there is anything better than regex?)</p>