title: iOS - WKURLSchemeHandler not called on custom scheme
body: <p>I want to use <code>WKWebView</code> and <code>WKURLSchemeHandler</code> to catch some links with custom schemes. To understand how it works, I've made a simple project (in Objective-C, sorry) with a local html file containing custom schemes</p>
  <pre class="lang-html prettyprint-override"><code>&lt;html&gt;
  
  &lt;h1&gt;Local Links&lt;/h1&gt;
  &lt;p&gt;&lt;a href=&quot;./www/page.html&quot;&gt;Local link&lt;/a&gt;&lt;/p&gt;
  &lt;p&gt;&lt;a href=&quot;./www/done.png&quot;&gt;Local Image&lt;/a&gt;&lt;/p&gt;
  
  &lt;h1&gt;MyScheme Links&lt;/h1&gt;
  &lt;p&gt;&lt;a href=&quot;myscheme://www/page.html&quot;&gt;Local link&lt;/a&gt;&lt;/p&gt;
  &lt;p&gt;&lt;a href=&quot;myscheme://www/done.png&quot;&gt;Local Image&lt;/a&gt;&lt;/p&gt;
  
  &lt;/html&gt;
  </code></pre>
  <p>In my <code>ViewController</code>, I initialize my webView as follow :</p>
  <pre><code>static NSString *const kCustomScheme = @&quot;myscheme&quot;;
  
  - (void)viewDidLoad {
      [super viewDidLoad];
      
      self.webView.navigationDelegate = self;
      [self.webView.configuration setURLSchemeHandler:[MySchemeHandler new] forURLScheme:kCustomScheme];
  }
  </code></pre>
  <p>Now, here is my custom SchemeHandler</p>
  <pre><code>#import &lt;Foundation/Foundation.h&gt;
  #import &lt;WebKit/WebKit.h&gt;
  
  @interface MySchemeHandler : NSObject&lt;WKURLSchemeHandler&gt;
  
  
  @end
  </code></pre>
  <pre><code>@interface MySchemeHandler () &lt;WKURLSchemeHandler&gt;
  
  @end
  
  @implementation MySchemeHandler
  
  # pragma mark - WKURLSchemeHandler callbacks
  
  - (void)webView:(nonnull WKWebView *)webView startURLSchemeTask:(nonnull id&lt;WKURLSchemeTask&gt;)urlSchemeTask {
      NSLog(@&quot;startURLScheme&quot;);
      if ([urlSchemeTask.request.URL.absoluteString containsString:kCustomScheme]) {
          NSLog(@&quot; --&gt; scheme found&quot;);
      } else {
          NSLog(@&quot; --&gt; scheme not found&quot;);
      }
  }
  
  - (void)webView:(nonnull WKWebView *)webView stopURLSchemeTask:(nonnull id&lt;WKURLSchemeTask&gt;)urlSchemeTask {
      NSLog(@&quot;stopURLScheme&quot;);
  }
  
  @end
  </code></pre>
  <p>With the above code, when I click on the custom link of my html page, nothing happens.</p>
  <p>What am I doing wrong ? I can't see my mistake... I'm pretty new in Objective-C or, to be exact, I'm a bit rusty after 10 years of Android. So I would be happy if you could help me <code>;)</code></p>