When I take a cookie and add it to a WKWebView's httpCookieStore, the cookie's version suddenly changes from 0 to 1.
Is this a bug, or is there some actual reason this should happen?
It's easily reproducible in Playgrounds like this:
import WebKit
import PlaygroundSupport
let cookie = HTTPCookie(properties: [.path: "/", .name: "foo", .value: "bar", .domain: "foobar.com", .version: 0])!
let webView = WKWebView()
print("My cookie is named \(cookie.name) and its version is \(cookie.version)")
webView.configuration.websiteDataStore.httpCookieStore.setCookie(cookie) {
webView.configuration.websiteDataStore.httpCookieStore.getAllCookies { cookies in
let transferredCookie = cookies.first!
print("Transferred cookie is named \(transferredCookie.name) and its version is \(transferredCookie.version)")
}
}
PlaygroundPage.current.needsIndefiniteExecution = trueThe output is this:
My cookie is named foo and its version is 0
Transferred cookie is named foo and its version is 1