How to synchronize cookies in WKWebview

We have changed from UIWebView we used to WKWebview. Changing WebView from UIWebView to WKWebView prevents login. Regenerate the PHPSESSID on the server in the login processing of the Web application and reconfigure it as a cookie. Because ios side can not confirm the update, I think that there is a problem with cookie synchronization processing. How do I synchronize cookies in WK WebView? ◆Configuration 【ios】 ios version: iOS9 Xcode:8.3.3 Swift3 【Server】   WebServer:CentOS framework:cakePHP 2.9.9(Using authComponent) ◆Reference processing https://qiita.com/yonell/items/bbd45c64a0068f7dc9c3 ◆Steps to Reproduce 1.Login authentication with WebAPI   ⇒PHPSESSID is returned from the server       Set PHPSESSID to HTTPCookieStorage.shared.cookies 2.Generate WebView with WKWebview   ⇒PHPSESSID returned from the server is set to WKWebView’s configuretion using WKUserScript 3.application login processing  ⇒Loading PHPSESSID obtained from server with MutableURLRequest.         ※At this time, the server regenerates PHPSESSID and reconfigures it as a cookie 4.Screen transition  ⇒It redirects to the login screen of the web application ★a problem occurred   In UIWebView, it transits to the screen after login normally. Supplement: The PHPSESSID is not updated even if check the cookie (HTTPCookieStorage and navigationAction.request.allHTTPHeaderField) at the timing of webView (_: decidePolicyFor: decisionHandler :). Thank you

Powered by WPeMatico

About

You may also like...

Comments are closed.