开发者

deleted NSHTTPCookie returns if app is terminated

After using some code to delete all of the cookies:

NSHTTPCookie *cookie;
    NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCooki开发者_Go百科eStorage];
    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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜