Instance Method

getCookiesForTask:completionHandler:

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

Declaration

- (void)getCookiesForTask:(NSURLSessionTask *)task completionHandler:(void (^)(NSArray<NSHTTPCookie *> *cookies))completionHandler;

Parameters

task

The task performing a request. The cookie storage can use the URL and other properties of this task’s request to determine which cookies to fetch.

completionHandler

A completion handler that receives an array of cookies as its argument.

See Also

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.