Class

NSHTTPCookieStorage

NSHTTPCookieStorage implements a singleton object (shared instance) that manages storage of cookies. Each cookie is represented by an instance of the NSHTTPCookie class. As a rule, cookies are shared among all applications and are kept in sync across process boundaries. Session cookies (where the cookie object’s sessionOnly method returns YES) are local to a single process and are not shared.

Overview

Thread Safety

In macOS 10.9 and later and iOS 7 and later, NSHTTPCookieStorage is thread safe.

Symbols

Creating and Initializing a Cookie Storage Object

- initWithStorageLocation:

Returns an initialized NSHTTPCookieStorage object with a given file system location to store cookie information on disk.

Getting and Setting the Cookie Accept Policy

cookieAcceptPolicy

The cookie storage’s cookie accept policy.

Adding and Removing Cookies

- deleteCookie:

Deletes the specified cookie from the cookie storage.

- setCookie:

Stores a specified cookie in the cookie storage if the cookie accept policy permits.

- setCookies:forURL:mainDocumentURL:

Adds an array of cookies to the receiver if the receiver’s cookie acceptance policy permits.

Retrieving Cookies

cookies

The cookie storage’s cookies.

- cookiesForURL:

Returns all the cookie storage’s cookies that are sent to a specified URL.

- sortedCookiesUsingDescriptors:

Returns all of the cookie storage’s cookies, sorted according to a given set of sort descriptors.

Constants

NSHTTPCookieAcceptPolicy

NSHTTPCookieAcceptPolicy specifies the cookie acceptance policies implemented by the NSHTTPCookieStorage class.

Notifications

NSHTTPCookieManagerCookiesChangedNotification

This notification is posted when the cookies stored in the NSHTTPCookieStorage instance have changed.

NSHTTPCookieManagerAcceptPolicyChangedNotification

This notification is posted when the acceptance policy of the NSHTTPCookieStorage instance has changed.

Relationships

Inherits From