Instance Method

URLSession:dataTask:didBecomeStreamTask:

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

Declaration

- (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didBecomeStreamTask:(NSURLSessionStreamTask *)streamTask;

Parameters

session

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

dataTask

The data task that was replaced by a stream task.

streamTask

The new stream task that replaced the data task.

Discussion

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

For requests that were pipelined, the stream task allows only reading, and the object immediately sends the delegate message URLSession:writeClosedForStreamTask:. You can disable pipelining for all requests in a session by setting the HTTPShouldUsePipelining property on its NSURLSessionConfiguration object, or for individual requests by setting the HTTPShouldUsePipelining property on an NSURLRequest object.

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:didBecomeDownloadTask:

Tells the delegate that the data task was changed to a download 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