Cookies always empty

Hi


I am using a WKWebView and the site is working. Now I need access to cookies that are being set. I found some code, but the cookies are always coming up with a count of 0. When I connect using Safari-WebInspector I am able wo see that the cookies are actually there. Help!


let cookieManager = NSHTTPCookieStorage.sharedHTTPCookieStorage()

cookieManager.cookieAcceptPolicy = NSHTTPCookieAcceptPolicy.Always

cookieStore = cookieManager.cookies!

logger.log("cookies: " + cookieStore.description);


output: cookies: []


I am seing that they show Expire Date of December 31 2000 in WebInspector, but when I connect via computer they show only Session for expiration. Do I need to alter the site javascript and change the cookie expiration somehow?

I'm having the same issue testing on all machines with 10.11 - verified that it works in 10.10 and earlier.


NSHTTPCookieStorage *cookieStorage = [NSHTTPCookieStorage sharedHTTPCookieStorage];


In 10.11 only, cookieStorage is empty.


Hope a fix is in the works!

Cookies always empty
 
 
Q