gpt4 book ai didi

iphone - NSHTTPCookieStorage 和 Cookie 过期日期

转载 作者:太空狗 更新时间:2023-10-30 03:41:44 25 4
gpt4 key购买 nike

在我们的 iPhone 应用程序中,我们在服务器通信期间使用两个 cookie。一种是短 session cookie (JSESSION),另一种是长 session cookie (REMEMBER ME)。如果服务器有响应,它会发送一个短 session cookie,我可以在 NSHTTPCookieStorage 中找到它。

我的问题是此存储如何处理 cookie 的到期日期?因此,如果 cookie 过期,它是否会自动删除该 cookie,如果我在过期后尝试通过其名称从存储中获取该 cookie,我会得到什么吗?还是我必须手动检查过期时间?

最佳答案

My question is how this storage handles the cookie's expiration date?

NSHTTPCookieStorage 将过期日期作为其属性之一存储 NSHTTPCookie 对象。

http://developer.apple.com/library/ios/#documentation/Cocoa/Reference/Foundation/Classes/NSHTTPCookie_Class/Reference/Reference.html#//apple_ref/occ/cl/NSHTTPCookie

So if the cookie expires, does it delete that cookie automatically, and if I try to get this cookie by it's name from the storage after expiration, do I get anything? Or do I have to check the expiration manually?

您应该手动检查过期并自行删除 cookie

正如在 http://developer.apple.com/library/ios/#documentation/Cocoa/Reference/Foundation/Classes/NSHTTPCookie_Class/Reference/Reference.html#//apple_ref/occ/cl/NSHTTPCookie 中提到的那样

The receiver’s expiration date, or nil if there is no specific expiration date such as in the case of “session-only” cookies. The expiration date is the date when the cookie should be deleted.

关于iphone - NSHTTPCookieStorage 和 Cookie 过期日期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7203641/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com