Instance Method

setCookie:

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

Declaration

- (void)setCookie:(NSHTTPCookie *)cookie;

Parameters

aCookie

The cookie to store.

Discussion

The cookie replaces an existing cookie with the same name, domain, and path, if one exists in the cookie storage. This method accepts the cookie only if the storage’s cookie accept policy is NSHTTPCookieAcceptPolicyAlways or NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain. The cookie is ignored if the storage’s cookie accept policy is NSHTTPCookieAcceptPolicyNever.

See Also

Adding and Removing Cookies

- removeCookiesSinceDate:

Removes cookies that were stored after a given date.

- deleteCookie:

Deletes the specified cookie from the cookie storage.

- setCookies:forURL:mainDocumentURL:

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

- storeCookies:forTask:

Stores an array of cookies in the cookie storage, on behalf of the provided task, if the cookie accept policy permits.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software