WKWebView 请求拦截

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: ''https' is a URL scheme that WKWebView handles natively'

 

-[WKWebViewConfiguration setURLSchemeHandler:forURLScheme:] + 95

 

不执行下面代码会报上面错误

 

+ (void)xx_swizzleWKWebView {

    [SWLSwizzle swizzleClassMethod:@selector(handlesURLScheme:) ofClass:[WKWebView class] withMethod:@selector(xx_handlesURLScheme:) ofClass:[WKWebView class]];

}

 

+ (BOOL)xx_handlesURLScheme:(NSString *)urlScheme {

    return YES;

}

posted @ 2021-08-19 19:35  zzfx  阅读(678)  评论(0编辑  收藏  举报