I have several ViewControllers with a built-in WKWebView. The application starts the controller of the initial form, which accesses the content from the server, for which WKWebView must store session information. When a user clicks on a tab in a TabBarController, a new view controller with built-in WKWebView starts. This new instance of WKWebView loads a new URL request for another page within the same domain. However, it seems that the session is saved between different instances of WebView because the page does not display correctly. I checked that this is a WKWebView problem, forcing to load the same page from the original view controller and on this page. In addition, I opened the same site using the Safari iOS browser, and it displays the page correctly.
I tried several ways to fix this problem without passing a single instance of WKWebView. At first I tried to pass a persistent instance of WKProcessPool, and that didn't work. I checked the WKWebSiteDataStore object for each load request in the view controllers, and it is the same database of objects in the memory cell. I also tried passing a persistent WKWebViewConfiguration object, and that didn't work either!
How to save session storage between separate instances of WKWebView?
source share