deleted NSHTTPCookie returns if app is terminated
Asked Answered
P

1

4

After using some code to delete all of the cookies:

NSHTTPCookie *cookie;
    NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
    for (cookie in [storage cookies]) {
        [storage deleteCookie:cookie];
    }

if you continue to use the app for a period of time, the cookies stay deleted. however, if you terminate the app immediately afterwards, the cookies will come back. sounds like some kind of cookie sync mechanism isn't kicking in fast enough, but the's no mention of it in the HTTPCookieStore docs.

How do you get a cookie to (reliably) stay deleted?

Perilune answered 21/2, 2011 at 19:41 Comment(0)
C
0

I do not think that there is a way to do that. Cookies are cached before they are sent to the NSHTTPCookie class and the same thing happens when you delete cookies. The class is told to delete the Cookies on quit, but won't if the app crashes as it doesn't catch the appropriate event.

Chromolithography answered 30/5, 2011 at 12:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.