iOS Code Snippet HttpJob Clear Cookies

Hello!

Is there a way to clear cookies from iHttpUtils2?

I found ways for B4A using JavaObject or Reflector and a custom HttpUtils2Service.

Is there a way with NativeObject possibly?

Thank you!
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
B4X:
Sub ClearCookies
Dim CookiesStorage As NativeObject
CookiesStorage = CookiesStorage.Initialize("NSHTTPCookieStorage").RunMethod("sharedHTTPCookieStorage", Null)
Dim Cookies As List = CookiesStorage.GetField("cookies")
For Each cookie As Object In Cookies
    CookiesStorage.RunMethod("deleteCookie:", Array(cookie))
Next
End Sub
 
Top