Instance Method

cookiesForURL:

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

Declaration

- (NSArray<NSHTTPCookie *> *)cookiesForURL:(NSURL *)URL;

Parameters

theURL

The URL to filter on.

Return Value

An array of cookies whose URL matches the provided URL.

Discussion

You can use the requestHeaderFieldsWithCookies: method of NSHTTPCookie to turn the array returned by this method into a set of header fields to add to an NSMutableURLRequest object.

If you override this method, also override getCookiesForTask:completionHandler:.

See Also

Retrieving Cookies

cookies

The cookie storage’s cookies.

- getCookiesForTask:completionHandler:

Fetches cookies relevant to the specified task and passes them to the completion handler.

- sortedCookiesUsingDescriptors:

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

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