Posts

Post not yet marked as solved
11 Replies
6.6k Views
Hi, thank you for reading the following questions: UIWebView can intercept network requests by registering NSURLProtocol sub-type like NSURLProtocol registerClass:[RNCachingURLProtocol class]]. Therefore, local resource files (such as: js,css,png) can be modified or uploaded. However, NSURLProtocol is not supported by WKWebView by default. If registered with a private API, WKWebView can intercept local resources in the way UIWebView does. The codes are as follows:Class cls = NSClassFromString(@"WKBrowsingContextController"); SEL sel = NSSelectorFromString(@"registerSchemeForCustomProtocol:"); if ([cls respondsToSelector:sel]) { [cls performSelector:sel withObject:@"http"]; [cls performSelector:sel withObject:@"https"]; } Regard to this, I’d like to know: 1.Will there be any risk if I use the above API in WKWebView? Is there any chance that my App would be rejected by App Review? 2. If the above private API is risky, is there any better solutions for this problem?Thanks again!
Posted
by AmazingAl.
Last updated
.