WKWebview 拦截 Scheme

  • WKWebView 只允许开发者拦截自定义 Scheme 的请求,如果在方法 - [WKWebViewConfiguration setURLSchemeHandler: forURLScheme:] 里设置 URLScheme: “http”,则 APP 会 crash , crash 信息为:

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

解决:
+ (BOOL)handlesURLScheme:(NSString *)urlScheme
{
    return NO;
}

详情:https://www.jianshu.com/p/7b28cbd8f92a

你可能感兴趣的:(WKWebview 拦截 Scheme)