Interface NSURLSessionDataDelegate

    • Method Detail

      • URLSessionDataTaskDidBecomeDownloadTask

        default void URLSessionDataTaskDidBecomeDownloadTask​(NSURLSession session,
                                                             NSURLSessionDataTask dataTask,
                                                             NSURLSessionDownloadTask downloadTask)
        Notification that a data task has become a download task. No future messages will be sent to the data task.
      • URLSessionDataTaskDidBecomeStreamTask

        default void URLSessionDataTaskDidBecomeStreamTask​(NSURLSession session,
                                                           NSURLSessionDataTask dataTask,
                                                           NSURLSessionStreamTask streamTask)
        Notification that a data task has become a bidirectional stream task. No future messages will be sent to the data task. The newly created streamTask will carry the original request and response as properties. For requests that were pipelined, the stream object will only allow reading, and the object will immediately issue a -URLSession:writeClosedForStream:. Pipelining can be disabled for all requests in a session, or by the NSURLRequest HTTPShouldUsePipelining property. The underlying connection is no longer considered part of the HTTP connection cache and won't count against the total number of connections per host.
      • URLSessionDataTaskDidReceiveData

        default void URLSessionDataTaskDidReceiveData​(NSURLSession session,
                                                      NSURLSessionDataTask dataTask,
                                                      NSData data)
        Sent when data is available for the delegate to consume. It is assumed that the delegate will retain and not copy the data. As the data may be discontiguous, you should use [NSData enumerateByteRangesUsingBlock:] to access it.
      • URLSessionDataTaskDidReceiveResponseCompletionHandler

        default void URLSessionDataTaskDidReceiveResponseCompletionHandler​(NSURLSession session,
                                                                           NSURLSessionDataTask dataTask,
                                                                           NSURLResponse response,
                                                                           NSURLSessionDataDelegate.Block_URLSessionDataTaskDidReceiveResponseCompletionHandler completionHandler)
        The task has received a response and no further messages will be received until the completion block is called. The disposition allows you to cancel a request or to turn a data task into a download task. This delegate message is optional - if you do not implement it, you can get the response as a property of the task. This method will not be called for background upload tasks (which cannot be converted to download tasks).