fryette / webview_cookie_manager

MIT License
48 stars 52 forks source link

Future returned by setCookies never finishes #47

Closed Aulig closed 3 years ago

Aulig commented 3 years ago

Hi, I'm awaiting the future returned by setCookies(), but since a few days it sometimes never finishes awaiting on iOS. No clue what's happening, sometimes it works but most of the time it waits forever. It used to work completely fine, so no idea why this is happening now. The issue occurs with both 2.0.0 and 2.0.1 but 2.0.0 definitely used to work.

No errors or output either.

Aulig commented 3 years ago

Turns out I wasn't awaiting it properly before. So the issue could always have been there, not just since recently. Only appears on iOS, Android is unaffected.

henrikvedal commented 3 years ago

I came across this problem today as well. After some debugging I found out that this only occurs for iOS if you send in an empty list of cookies. An easy fix is to check if your list of cookies is empty before calling setCookies().

It seems like the problem is in SwiftWebviewCookieManagerPlugin.swift line 103. The result is never set to true if the list is empty. I think it should be returned somewhere after line 43.

fryette commented 3 years ago

Contribution is very appreciated.