How to cancel the request for interception of WKWebView

 

Use unregisterSchemeForCustomProtocol unblock

 

    [NSURLProtocol unregisterClass:[MyURLProtocol class]];

    Class cls = NSClassFromString(@"WKBrowsingContextController");
    SEL sel = NSSelectorFromString(@"unregisterSchemeForCustomProtocol:");
    if ([(id)cls respondsToSelector:sel]) {
        [(id)cls performSelector:sel withObject:@"http"];
        [(id)cls performSelector:sel withObject:@"https"];
    }

 

 

Time and then need to intercept

    [NSURLProtocol registerClass:[MyURLProtocol class]];

    Class cls = NSClassFromString(@"WKBrowsingContextController");
    SEL sel = NSSelectorFromString(@"registerSchemeForCustomProtocol:");
    if ([(id)cls respondsToSelector:sel]) {
        [(id)cls performSelector:sel withObject:@"http"];
        [(id)cls performSelector:sel withObject:@"https"];
    }

 

Published 120 original articles · won praise 15 · views 170 000 +

Guess you like

Origin blog.csdn.net/qq_15509071/article/details/89398355