ios 的cookie处理机制


简单说不论是NSURLConnection仍是UIWebView都会保留并传递服务端的cookie,重启进程,或重启系统cookie都在应用中。 html

2.多个应用间默认是不共亨cookie的 web

3.删除重装应用cookie会被清除 cookie


Cookie Storage

Due to the stateless nature of the HTTP protocol, cookies are often used to provide persistent storage of data across URL requests. The URL loading system provides interfaces to create and manage cookies as well as sending and receiving cookies from web servers. app

The NSHTTPCookie class encapsulates a cookie, providing accessors for many of the common cookie attributes. It also provides methods to convert HTTP cookie headers toNSHTTPCookie instances and convert an NSHTTPCookie instance to headers suitable for use with an NSURLRequest. The URL loading system automatically sends any stored cookies appropriate for an NSURLRequest. unless the request specifies not to send cookies. Likewise, cookies returned in an NSURLResponse are accepted in accordance with the current cookie acceptance policy. less

The NSHTTPCookieStorage class provides the interface for managing the collection of NSHTTPCookie objects shared by all applications. dom

iOS Note: Cookies are not shared by applications in iOS. iphone

NSHTTPCookieStorage allows an application to specify a cookie acceptance policy. The cookie acceptance policy controls whether cookies should always be accepted, never be accepted, or accepted only from the same domain as the main document URL. ide

Note: Changing the cookie acceptance policy in an application affects the cookie acceptance policy for all other running applications. post

When another application changes the cookie storage or the cookie acceptance policy, NSHTTPCookieStorage notifies an application by posting theNSHTTPCookieStorageCookiesChangedNotification and NSHTTPCookieStorageAcceptPolicyChangedNotification notifications. ui


http://pathfindersoftware.com/2008/12/iphonesdk-cache-and-cookies/


https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/URLLoadingSystem/Concepts/URLOverview.html#//apple_ref/doc/uid/20001834-157091

相关文章
相关标签/搜索