ios-获取wkwebview里的cookie

1
2
3
4
5
6
7
8
9
10
if (@available(iOS 11.0, *)) {  //available on iOS 11+
WKHTTPCookieStore *cookieStore = webView.configuration.websiteDataStore.httpCookieStore;
[cookieStore getAllCookies:^(NSArray* cookies) {
if (cookies.count > 0) {
for (NSHTTPCookie *cookie in cookies) {
//TODO...
}
}
}];
}