WKNavigationResponse is no longer providing access to cookies through its response.header in iOS 12,
So,I have to user the new API to get all cookies. when I use the getAllCookies:
,sometimes it didn't call the completionHandler,sometimes it called the completionHandler without session cookies contain.
under certain circumstances,I need to get the session cookies.
Why does WKHTTPCookieStore's API -- getAllCookies can't always call the completionHandler ?And,why sometimes it called the completionHandler but have no session cookies contain?
Or,Does that have any way to get all cookies contains session cookies from WKWebView?
WKHTTPCookieStore *cookieStore = webView.configuration.websiteDataStore.httpCookieStore;
[cookieStore getAllCookies:^(NSArray* cookies) {
// case 1: didn't call this completionHandler
for (NSHTTPCookie *cookie in cookies) {
//case 2 called this completionHandler without session cookie contains
}
}];