Instance Method

getTasksWithCompletionHandler:

Asynchronously calls a completion callback with all data, upload, and download tasks in a session.

Declaration

- (void)getTasksWithCompletionHandler:(void (^)(NSArray<NSURLSessionDataTask *> *dataTasks, NSArray<NSURLSessionUploadTask *> *uploadTasks, NSArray<NSURLSessionDownloadTask *> *downloadTasks))completionHandler;

Parameters

completionHandler

The completion handler to call with the list of tasks. This handler is executed on the delegate queue.

Discussion

The arrays passed to the completion handler contain any tasks that you have created within the session, not including any tasks that have been invalidated after completing, failing, or being cancelled.

See Also

Managing the Session

- finishTasksAndInvalidate

Invalidates the session, allowing any outstanding tasks to finish.

- flushWithCompletionHandler:

Flushes cookies and credentials to disk, clears transient caches, and ensures that future requests occur on a new TCP connection.

- getAllTasksWithCompletionHandler:

Asynchronously calls a completion callback with all tasks in a session

- invalidateAndCancel

Cancels all outstanding tasks and then invalidates the session.

- resetWithCompletionHandler:

Empties all cookies, caches and credential stores, removes disk files, flushes in-progress downloads to disk, and ensures that future requests occur on a new socket.

sessionDescription

An app-defined descriptive label for the session.