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

相關文章
相關標籤/搜索