NSHTTPCookieStorage 和 Cookie 过期日期
在我们的 iPhone 应用程序中,我们在服务器通信期间使用两个 cookie。一种是短会话 cookie (JSESSION),另一种是长会话 cookie (REMEMBER ME)。如果答案来自服务器,它会发送一个短会话 cookie,我可以在 NSHTTPCookieStorage 中找到它。
我的问题是这个存储如何处理 cookie 的过期日期?因此,如果 cookie 过期,它是否会自动删除该 cookie,并且如果我在过期后尝试通过其名称从存储中获取此 cookie,我会得到什么吗?还是我必须手动检查过期时间?
In our iPhone app we use two cookies during server communication. One is a short session cookie (JSESSION), and the other is a long session cookie (REMEMBER ME). If an answer comes from the server, it sends a short session cookie, which I can find in the NSHTTPCookieStorage.
My question is how this storage handles the cookie's expiration date? So if the cookie expires, does it delete that cookie automatically, and if I try to get this cookie by its name from the storage after expiration, do I get anything? Or do I have to check the expiration manually?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
NSHTTPCookieStorage 存储将过期日期作为其属性之一的 NSHTTPCookie 对象。
http://developer.apple.com/library/ios/#documentation/Cocoa/Reference/Foundation/Classes/NSHTTPCookie_Class/Reference/Reference.html#//apple_ref/occ/cl/NSHTTPCookie
您应该手动检查过期情况并自行删除 cookie,
正如 http://developer.apple.com/library/ios/#documentation/Cocoa/Reference/Foundation/Classes/NSHTTPCookie_Class/Reference/Reference.html#//apple_ref/occ/cl/NSHTTPCookie
NSHTTPCookieStorage stores the NSHTTPCookie objects that has expiration date as one of its property.
http://developer.apple.com/library/ios/#documentation/Cocoa/Reference/Foundation/Classes/NSHTTPCookie_Class/Reference/Reference.html#//apple_ref/occ/cl/NSHTTPCookie
You should check manually for expiration and delete the cookie yourself
As it is referred in http://developer.apple.com/library/ios/#documentation/Cocoa/Reference/Foundation/Classes/NSHTTPCookie_Class/Reference/Reference.html#//apple_ref/occ/cl/NSHTTPCookie
为了更加实用...
To be more practical...