How to synchronize cookies in WKWebview

Please tell me how to keep the cookie of WKWebbview.


I'm changing Webview from UIWebView to WKWebview.

I can not get session ID (cookie) regenerated by server login authentication and Then I can not log in.

It looks like cookie synchronization does not go well.

So please tell me how to keep the cookie of WK Webbview.


I am programing by the link method below

https://qiita.com/yonell/items/bbd45c64a0068f7dc9c3

iOS9

Swift3

Xcode:8.x

< login authentication>

1.Login authentication with WebAPI

 ⇒Get PHPSESSID from server


2.Send PHPSESSID with MutableURLRequest

※I set PHPSESSID to WKWebview with WKUserScript


3.Login authentication with server (using cakephp authComponent)

 ⇒Regenerate session ID and reset to cookie(PHPSESSID)★

 ★problem

  The cookie of the request is not updated at the timing of webView (decidePolicyFor: decisionHandler )

I suspect sanae.g’s got lost in the moderation queue. Regardless, for those following along at home I responded on this other thread.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
How to synchronize cookies in WKWebview
 
 
Q