Cookies not visible in WKWebView on iOS 16 Simulators

We are injecting cookies using a nonPersistent() data store before creating the WKWebView (on completion).

This works fine on prior versions (and I know Xcode 14 is in beta) but is no longer working in Xcode 14 / iOS 16 simulators and I see no posts, bugs raised or release notes for this so I'm raising it here to see if anyone else is experiencing this?

I can see that the cookies are present in the WKHTTPCookieStore accessed via webView.configuration.websiteDataStore.httpCookieStore.getAllCookies. But both Safari debugging and our JS code embedded on the site can see no cookies.

This is broken for wildcard cookie injection. Definitely an issue with iOS 16 and I see no release notes or documentation that covers it.

Specifically injecting a cookie on a site such as sub.example.com with the domain .example.com used to work but no longer does and this contradicts the Apple documentation: https://developer.apple.com/documentation/foundation/httpcookie/1393015-domain

If the domain does not start with a dot, then the cookie is only sent to the exact host specified by the domain. If the domain does start with a dot, then the cookie is sent to other hosts in that domain as well, subject to certain restrictions. See RFC 6265 for more detail.

Injecting with sub.example.com works as expected. Injecting with example.com does not work.

Still seems to be an issue on Xcode and iOS beta 5

Update on this: I submitted a sample project to Apple.

However, I have found that this works on Apple's website in the sample app but not on our own which points to a web config issue.

This was working in previous iOS versions, is no longer working in iOS 16, and there has been no change posted by Apple so I am still convinced something is wrong here. Just waiting for a response...

Cookies not visible in WKWebView on iOS 16 Simulators
 
 
Q