Instance Method

URLSession:dataTask:didBecomeDownloadTask:

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

Declaration

- (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didBecomeDownloadTask:(NSURLSessionDownloadTask *)downloadTask;

Parameters

session

The session containing the task that was replaced by a download task.

dataTask

The data task that was replaced by a download task.

downloadTask

The new download task that replaced the data task.

Discussion

When your URLSession:dataTask:didReceiveResponse:completionHandler: delegate method uses the NSURLSessionResponseBecomeDownload disposition to convert the request to use a download, the session calls this delegate method to provide you with the new download task. After this call, the session delegate receives no further delegate method calls related to the original data task.

See Also

Handling Task Life Cycle Changes

- URLSession:dataTask:didReceiveResponse:completionHandler:

Tells the delegate that the data task received the initial reply (headers) from the server.

NSURLSessionResponseDisposition

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

- URLSession:dataTask:didBecomeStreamTask:

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