Search code examples
wkwebview

WKWebsiteDataStore vs HTTPCookieStorage


WKWebsiteDataStore.default().httpCookieStore.getAllCookies returns a different list of cookies from HTTPCookieStorage.shared.cookies. What is the difference between these two methods?


Solution

  • HTTPCookieStorage.shared will be used with URLSession.shared network requests.

    WKWebsiteDataStore.default() is used for WKWebView only. And the getAllCookies is asynchronous

    Both are persistent.