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.