Schemes in WKWebView


Gerriet M. Denkmann
 

iOS 11.

I created MySchemeHandler, which implements the WKURLSchemeHandler protocol; methods just do NSLog().

NSString *myScheme = @"myScheme";

[wkWebView.configuration setURLSchemeHandler: mySchemeHandler forURLScheme: myScheme];

NSURLComponents *uc = [ [ NSURLComponents alloc ] init ];
uc.scheme = myScheme;
uc.path = @“/abcXYZ";
NSURLRequest *ur = [ NSURLRequest requestWithURL: uc.URL ];
WKNavigation *wn = [ wkWebView loadRequest: ur ];

but nothing happens; MySchemeHandler gets never called.

What am I missing?

Gerriet.

Join cocoa@apple-dev.groups.io to automatically receive all group messages.