| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/Foundation.framework  | 
| Availability | Available in Mac OS X v10.2 with Safari 1.0 installed. Available in Mac OS X v10.2.7 and later.  | 
| Companion guide | |
| Declared in | NSHTTPCookieStorage.h  | 
NSHTTPCookieStorage implements a singleton object (shared instance) that manages the shared cookie storage. These cookies are shared among all applications and are kept in sync cross-process.
Note: Changes made to the cookie accept policy will affect all currently running applications using the cookie storage.
Returns the shared cookie storage instance.
+ (NSHTTPCookieStorage *)sharedHTTPCookieStorage
The shared cookie storage instance.
NSHTTPCookieStorage.hReturns the receiver’s cookie accept policy.
- (NSHTTPCookieAcceptPolicy)cookieAcceptPolicy
The receiver's cookie accept policy. The default cookie accept policy is NSHTTPCookieAcceptPolicyAlways.
NSHTTPCookieStorage.hReturns the receiver’s cookies.
- (NSArray *)cookies
An array containing all of the receiver’s cookies.
NSHTTPCookieStorage.hReturns all the receiver's cookies that will be sent to a specified URL.
- (NSArray *)cookiesForURL:(NSURL *)theURL
The URL to filter on.
An array of cookies whose URL matches the provided URL.
An application can use NSHTTPCookie’s requestHeaderFieldsWithCookies: method to turn this array into a set of header fields to add to an NSMutableURLRequest object.
NSHTTPCookieStorage.hDeletes the specified cookie from the receiver.
- (void)deleteCookie:(NSHTTPCookie *)aCookie
The cookie to delete.
NSHTTPCookieStorage.hStores a specified cookie in the receiver if the receiver's cookie accept policy permits.
- (void)setCookie:(NSHTTPCookie *)aCookie
The cookie to store.
The cookie will replace an existing cookie with the same name, domain and path, if one exists in the cookie storage. This method will accept the cookie only if the receiver’s cookie accept policy is NSHTTPCookieAcceptPolicyAlways or NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain. The cookie will be ignored if the receiver’s cookie accept policy is NSHTTPCookieAcceptPolicyNever.
NSHTTPCookieStorage.hSets the cookie accept policy of the receiver
- (void)setCookieAcceptPolicy:(NSHTTPCookieAcceptPolicy)aPolicy
The new cookie accept policy.
The default cookie accept policy is NSHTTPCookieAcceptPolicyAlways. Changing the cookie policy will affect all currently running applications using the cookie storage.
NSHTTPCookieStorage.hAdds an array of cookies to the receiver if the receiver’s cookie acceptance policy permits.
- (void)setCookies:(NSArray *)cookies forURL:(NSURL *)theURL mainDocumentURL:(NSURL *)mainDocumentURL
The cookies to add.
The URL associated with the added cookies.
The URL of the main HTML document for the top-level frame, if known. Can be nil. This URL is used to determine if the cookie should be accepted if the cookie accept policy is NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain.
The cookies will replace existing cookies with the same name, domain, and path, if one exists in the cookie storage. The cookie will be ignored if the receiver's cookie accept policy is NSHTTPCookieAcceptPolicyNever. 
To store cookies from a set of response headers, an application can use cookiesWithResponseHeaderFields:forURL: passing a header field dictionary and then use this method to store the resulting cookies in accordance with the receiver’s cookie acceptance policy.
NSHTTPCookieStorage.hNSHTTPCookieAcceptPolicy specifies the cookie acceptance policies implemented by the NSHTTPCookieStorage class.
typedef enum {
   NSHTTPCookieAcceptPolicyAlways,
   NSHTTPCookieAcceptPolicyNever,
   NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain
} NSHTTPCookieAcceptPolicy;
NSHTTPCookieAcceptPolicyAlwaysAccept all cookies. This is the default cookie accept policy.
Available in Mac OS X v10.2 and later.
Declared in NSHTTPCookieStorage.h.
NSHTTPCookieAcceptPolicyNeverReject all cookies.
Available in Mac OS X v10.2 and later.
Declared in NSHTTPCookieStorage.h.
NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomainAccept cookies only from the main document domain.
Available in Mac OS X v10.2 and later.
Declared in NSHTTPCookieStorage.h.
NSHTTPCookieStorage.h
This notification is posted when the cookies stored in the NSHTTPCookieStorage instance have changed. Since cookies are shared among applications, this notification can be sent in response to another application’s actions.
The notification object is the NSHTTPCookieStorage instance. This notification does not contain a userInfo dictionary. 
NSHTTPCookieStorage.h
This notification is posted when the acceptance policy of the NSHTTPCookieStorage instance has changed. Since cookies are shared among applications, this notification can be sent in response to another application’s actions.
The notification object is the NSHTTPCookieStorage instance. This notification does not contain a userInfo dictionary. 
NSHTTPCookieStorage.h
        © 2006 Apple Computer, Inc. All Rights Reserved. (Last updated: 2006-05-23)