Contents

URLSessionTask

A task, like downloading a specific resource, performed in a URL session.

Declaration

class URLSessionTask

Mentioned in

Overview

The URLSessionTask class is the base class for tasks in a URL session. Tasks are always part of a session; you create a task by calling one of the task creation methods on a URLSession instance. The method you call determines the type of task.

After you create a task, you start it by calling its resume() method. The session then maintains a strong reference to the task until the request finishes or fails; you don’t need to maintain a reference to the task unless it’s useful for your app’s internal bookkeeping.

Topics

Controlling the task state

Obtaining task progress

Obtaining general task information

Determining task behavior

Using a task-specific delegate

Scheduling tasks

Deprecated

See Also

Essentials