Protocol

NSURLSessionDelegate

A protocol that defines methods that URL session instances call on their delegates to handle session-level events, like session life cycle changes.

Declaration

@protocol NSURLSessionDelegate

Overview

In addition to the methods defined in this protocol, most delegates should also implement some or all of the methods in the NSURLSessionTaskDelegate, NSURLSessionDataDelegate, and NSURLSessionDownloadDelegate protocols to handle task-level events. These include events like the beginning and end of individual tasks, and periodic progress updates from data or download tasks.

Topics

Handling Session Life Cycle Changes

- URLSession:didBecomeInvalidWithError:

Tells the URL session that the session has been invalidated.

- URLSessionDidFinishEventsForBackgroundURLSession:

Tells the delegate that all messages enqueued for a session have been delivered.

Handling Authentication Challenges

- URLSession:didReceiveChallenge:completionHandler:

Requests credentials from the delegate in response to a session-level authentication request from the remote server.

NSURLSessionAuthChallengeDisposition

Constants passed by session or task delegates to the provided continuation block in response to an authentication challenge.

Relationships

Inherits From

See Also

Working with a Delegate

delegate

The delegate assigned when this object was created.

NSURLSessionTaskDelegate

A protocol that defines methods that URL session instances call on their delegates to handle task-level events.

delegateQueue

The operation queue provided when this object was created.