从WKWebView获取所有cookie
使用来获取cookieUIWebView似乎很简单NSHTTPCookieStorage.sharedHTTPCookieStorage(),似乎WKWebView将cookie存储在其他位置。 我做了一些研究,然后从NSHTTPURLResponse对象中获取了一些Cookie 。但是,其中不包含WKWebView: func webView(webView: WKWebView, decidePolicyForNavigationResponse navigationResponse: WKNavigationResponse, decisionHandler: (WKNavigationResponsePolicy) -> Void) { if let httpResponse = navigationResponse.response as? NSHTTPURLResponse { if let headers = httpResponse.allHeaderFields as? [String: String], url = httpResponse.URL { let cookies = NSHTTPCookie.cookiesWithResponseHeaderFields(headers, forURL: url) for cookie in cookies { logDebug(cookie.description) logDebug("found cookie " + …