Questions tagged [wkhttpcookiestore]

16 questions
10
votes
0 answers

WKWebView does not update document.cookie when setting cookies in WKHTTPCookieStore

Context: I have an iOS Cordova application using WKWebView. I need to intercept WKWebView requests which is not possible using http|https scheme (it was possible using UIWebView but I have to move to WKWebView). Therefore I have set in Cordova's…
Zack
  • 101
  • 3
9
votes
3 answers

WKWebView setting Cookie not possible (iOS 11+)

I am desperately trying to add a custom cookie to a WKWebView instance (without using Javascript or similar workarounds). From iOS 11 and upwards, Apple provides an API to do this: The WKWebViews WKWebsiteDataStore has a property…
naglerrr
  • 2,489
  • 1
  • 10
  • 22
8
votes
2 answers

WKWebview getAllCookies crash in iOS 11.3

We have recently migrated to WKWebview. We have added a listener for cookie change, to get the updated cookies and update our own store. - (void)cookiesDidChangeInCookieStore:(WKHTTPCookieStore *)cookieStore { [cookieStore…
7
votes
0 answers

WKHTTPCookieStore not retrieving set Cookie.

I'm trying to set a cookie programmatically but it's not working. The cookie gives the impression that it's valid. I then set it on the WKWebsiteDataStore.default().httpCookieStore. In the asynchronous call back I then try to get all the cookies out…
Mark Bridges
  • 7,606
  • 4
  • 43
  • 59
5
votes
0 answers

From IOS 13.0 cookiesDidChange is never triggered when cookies change on webview

I am using Cookie Store Observer to to track changes in the cookies value on my webview. It was working fine on all versions of IOS. but since IOS 13.0 came out, this no longer works. I am not getting any call to @available(iOS 11.0, *) func…
Easy Coder
  • 237
  • 3
  • 9
4
votes
0 answers

WKWebView always unauthenticated on first load on simulator - then it's authenticated on all subsequent loads

In my app, I am loading a page that requires authentication in a WKWebView. On device, it is always authenticated on first load, because I have the proper cookies to authenticate it. However, if I "Erase All Content Settings" on the simulator (under…
3
votes
0 answers

Shared NSHTTPCookieStorage will sync persistent cookies to WKWebsiteDataStore defaultDataStore httpCookieStore?

I found an interesting fact that the shared NSHTTPCookieStorage will sync persistent cookies(isSessionOnly=false) to WKWebsiteDataStore.defaultDataStore.httpCookieStore, could anyone tell me if this is a feature or kind of unreliable behavior? No…
Cyme
  • 31
  • 3
3
votes
1 answer

WKHTTPCookieStore getAllCookies completionhandler not called in some OS versions

Our iOS application reads cookies from WKHTTPCookieStore to call the initialization webservice. If the specific cookie we are looking for is not present in the CookieStore, will pass empty value in the webservice and it will return the relevant…
Vineeth
  • 1,591
  • 1
  • 15
  • 22
2
votes
2 answers

WKHTTPCookieStorage's setCookie doesn't return after closing and opening web view

I have the code below to copy cookies from the general HTTPCookieStorage, into my webview's cookie store. After all cookies are copied, I load the webview let webView = WKWebView(frame: containerView.bounds, configuration:…
Binya Koatz
  • 139
  • 1
  • 6
1
vote
1 answer

WKHTTPCookieStore HTTPCookieStorage synchronization class

Use case: I have two WKWebViews, one in a main app and one in an app extension. I want them to share the same cookie store. Apple APIs have 2 different cookie storage classes: WKHTTPCookieStore and HTTPCookieStorage. Apple also has…
1
vote
0 answers

Is there a way to see when an HTTPCookie is available to a WKWebView?

Disclaimer I am aware that there are several issues related to this question and I have looked at all of them that I could, but they seem to be asking questions about how to sync the cookies in general. This is unlike those, in the sense that the…
brandenesmith
  • 136
  • 1
  • 8
1
vote
0 answers

Why does WKHTTPCookieStore's API -- getAllCookies called the completionHandler but have no session cookies contains

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…
G.Xiao
  • 11
  • 3
0
votes
0 answers

How to add Cookie in WKWebView SwiftUI UIViewRepresentable?

I'm implementing a functionality for adding a cookie in SwiftUI WKWebview that I created using UIViewRepresentable. I followed some steps to add cookie in a normal UIKit implementation and tried implementing it in the init of UIViewRepresentable…
0
votes
0 answers

Any other possibility that WKWebView won't add Cookies?

I know this question may look like frequently asked ones, but mine is probably something beyond them. My objective is pretty simple, I just want to add cookies when opening websites. I'm using WKWebView with WKHTTPCookieStore and doing like this. …
0
votes
1 answer

How can I persists cookies across app restarts with WKWebView / WKHTTPCookieStore

I have a requirement to persist my cookies across application restarts. Originally when using UIWebView I was able to achieve this with an extension on UserDefaults import Foundation extension UserDefaults { typealias CookieProperties =…
Tim J
  • 901
  • 4
  • 17
1
2