How to synchronize cookie in WKWebview of earlier than ios 11

Hello, as we know,


httpCookieStore.setCookie just available after ios 11.0, I have saw the thread: https://forums.developer.apple.com/message/288999#288999

I have tried set a cookie in the headers of the request or evaluateJavaScript:completionHandler,

but it didn't work, could you tell me how to compatible of earlier ios 11.

Answered by flooer in 302757022

It can, but that is not the point, I just need a method set cookie into WKWebviewCookieStore of earlier than ios 11.

As it is said in this older thread, that may be tricky to implement.


Why not test for IOS version in your code, and only set cookie if 11.0 or more?


Already more than 65% (probably now 70%) of IOS devices run IOS 11.

h ttps://developer.apple.com/support/app-store/

Hello, I know new is better, but don't set cookie in there, the older user can't see the content when need login, this is a problem.

Sure, it is not as good. But can't you ask for login again ? just as if user had disabled cookies or for the first visit.

Accepted Answer

It can, but that is not the point, I just need a method set cookie into WKWebviewCookieStore of earlier than ios 11.

How to synchronize cookie in WKWebview of earlier than ios 11
 
 
Q