Type Method

cookiesWithResponseHeaderFields:forURL:

Creates an array HTTP cookies corresponding to the provided response header fields for the provided URL.

Declaration

+ (NSArray<NSHTTPCookie *> *)cookiesWithResponseHeaderFields:(NSDictionary<NSString *,NSString *> *)headerFields forURL:(NSURL *)URL;

Parameters

headerFields

The header fields used to create the NSHTTPCookie objects.

URL

The URL associated with the created cookies.

Return Value

The array of created cookies.

Discussion

This method ignores irrelevant header fields in headerFields, allowing dictionaries to contain additional data.

If headerFields doesn’t specify a domain for a given cookie, the cookie is created with a default domain value of URL.

If headerFields doesn’t specify a path for a given cookie, the cookie is created with a default path value of "/".

See Also

Creating Cookies

+ cookieWithProperties:

Creates and initializes an HTTP cookie object using the provided properties.

- initWithProperties:

Initializes an HTTP cookie object with the given cookie properties.

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