Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS CookieManager setCookie doesn't wait for cookie to actually have been set #196

Closed
ollisal opened this issue Nov 19, 2019 · 5 comments
Closed

Comments

@ollisal
Copy link

ollisal commented Nov 19, 2019

Hi and thanks for the great library! Especially happy about the scroll callback which allows us to implement some nice effects in our app.

We have one problem though - we inject a particular login session used by the outside app to inside InAppWebViews using CookieManager. On Android this works perfectly. On iOS the cookies aren't available in the InAppWebView reliably when needed, especially if another InAppWebView has been alive in the app before.

I think this might be due to the iOS CookieManager not passing a completionHandler when it calls the setCookie method:

https://github.com/pichillilorenzo/flutter_inappbrowser/blob/68ff79c71686987fc5bdc447f2c68a723a821ca6/ios/Classes/MyCookieManager.swift#L96

That WKHTTPCookieStore method DOES have a completion handler, like the other methods we're calling, which we pass a completion handler to: https://developer.apple.com/documentation/webkit/wkhttpcookiestore/2882007-setcookie?language=objc

Is there some reason why the completion handler isn't used here? As a workaround, we can loop to check for the cookies having been set, but that's a bit messy.

@robertcnst
Copy link

#198 this may help you :)

@pichillilorenzo
Copy link
Owner

Updated the master branch with that fix and created the new 1.2.2 version with only that fix.

@koskimas
Copy link

Wow, that was fast! Thank you @robertcnst and @pichillilorenzo! 🍻

@ollisal
Copy link
Author

ollisal commented Nov 29, 2019

@pichillilorenzo Thanks! We've now verified that the fixed version works without any workarounds for setting the cookies.

This was referenced Jul 6, 2020
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants