我一直在寻找一种方法来为 WKWebview 请求设置代理,但没有成功。
另一方面,我已经能够将代理设置为 http 请求
func createURLSessionConfiguration(_ host:String,_ port:String) -> URLSessionConfiguration {
let config = URLSessionConfiguration.default
config.requestCachePolicy = URLRequest.CachePolicy.reloadIgnoringLocalCacheData
config.connectionProxyDictionary = [AnyHashable: Any]()
config.connectionProxyDictionary?[kCFNetworkProxiesHTTPEnable as String] = 1
config.connectionProxyDictionary?[kCFNetworkProxiesHTTPSProxy as String] = host
config.connectionProxyDictionary?[kCFNetworkProxiesHTTPSPort as String] = port
return config
}
但是我对你们的问题是如何将代理设置为 WKWebView?
我会非常感谢你的帮助