Enumeration

URLSession.ResponseDisposition

Constants indicating how a data or upload session should proceed after receiving the initial headers.

Declaration

enum ResponseDisposition : Int

Overview

When a data or upload task first receives a response, it calls the urlSession(_:dataTask:didReceive:completionHandler:) method of URLSessionDataDelegate. Implement this method to inspect the received URLResponse and then call the provided completion handler. The first parameter to the completion handler is of this type, a disposition that tells the task how to proceed.

Topics

Task Dispositions

case cancel

Cancel the load.

case allow

Allow the load operation to continue.

case becomeDownload

Convert the response for this request to use a URLSessionDownloadTask.

case becomeStream

Convert the response for this request to use a URLSessionStreamTask.

See Also

Handling Task Life Cycle Changes

func urlSession(URLSession, dataTask: URLSessionDataTask, didBecome: URLSessionDownloadTask)

Tells the delegate that the data task was changed to a download task.

func urlSession(URLSession, dataTask: URLSessionDataTask, didBecome: URLSessionStreamTask)

Tells the delegate that the data task was changed to a stream task.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software