Intercept and cache requests of WKWebView.
网易团队采用了更完整细致(原理相同)的解决方案,建议采用他们的: WKWebView 请求拦截探索与实践
Drag the
SSWKURL.h
and
SSWKURL.m
files into your project.
Subclass
SSWKURLProtocol
like
NSURLProtol
.
Implement your own
-startLoading:
and
-stopLoading
.
Then call
[yourWKURLConfiguration ssRegisterURLProtocol:[YourSSWKURLProtocol class]];
Then You could moniter requests or load cache for requests.
WKWebView完美(?)网络请求拦截 WKWebView缓存+请求拦截 网易团队采用了更完整细致(原理相同)的解决方案,建议采用他们的: WKWebView 请求拦截探索与实践