func webView(webView: WKWebView!,decidePolicyForNavigationAction navigationAction: WKNavigationAction!,decisionHandler: ((WKNavigationActionPolicy) -> Void)!) { var request = NSMutableURLRequest(URL: navigationAction.request.URL) request.setValue("value",forHTTPHeaderField: "key") decisionHandler(.Allow) }
在上面的代码中,我想为请求添加一个标头.
我试过做navigationAction.request.setValue(“IOS”,forKey:“DEVICE_APP”),但它不起作用.
请以任何方式帮助我.