Cookie storages HTTPCookieStorage & WKHTTPCookieStore sync issue

Hello, community

We have an issue with synchronizing the cookies between storages HTTPCookieStorage and WKHTTPCookieStore.

We use REST API requests and WKWebView as part of the application. Customer environment directly linked to cookies, so WKWebView and URLRequests both can change cookies and we need to check/sync for actual cookies in both storages after completing requests.

As we know, by default "from the box" there is sync from HTTPCookieStorage to WKHTTPCookiesStorage, and there is no sync from WKHTTPCookieStorage to HTTPCookieStorage. But, as we know from the forum questions, sync "from the box" not working from ios 11.3.

We created a custom CookieSync manager, which manually synchronizes cookies between storages after each request (API and WebView), with storage priority. For the manager, we use the same WKWebSiteDataStore, as for each WKWebView object.

From our debug and testing processes results, we know that storages don't synchronize correctly. Maybe this linked with the fact, that WKHTTPCookieStore works asynchronously.

From our testing and debug results, we have issues with synchronizing some cookies, which critically important for us and our customers. Maybe anyone knows methods or variants to simply and correctly synchronize cookies?

Best regards,

Dmytrii Golovanov