Interface NSURLSessionTaskDelegate

    • Method Detail

      • URLSessionTaskDidCompleteWithError

        default void URLSessionTaskDidCompleteWithError​(NSURLSession session,
                                                        NSURLSessionTask task,
                                                        NSError error)
        Sent as the last message related to a specific task. Error may be nil, which implies that no error occurred and this task is complete.
      • URLSessionTaskDidFinishCollectingMetrics

        default void URLSessionTaskDidFinishCollectingMetrics​(NSURLSession session,
                                                              NSURLSessionTask task,
                                                              NSURLSessionTaskMetrics metrics)
        Sent when complete statistics information has been collected for the task.
      • URLSessionTaskDidSendBodyDataTotalBytesSentTotalBytesExpectedToSend

        default void URLSessionTaskDidSendBodyDataTotalBytesSentTotalBytesExpectedToSend​(NSURLSession session,
                                                                                         NSURLSessionTask task,
                                                                                         long bytesSent,
                                                                                         long totalBytesSent,
                                                                                         long totalBytesExpectedToSend)
        Sent periodically to notify the delegate of upload progress. This information is also available as properties of the task.
      • URLSessionTaskWillPerformHTTPRedirectionNewRequestCompletionHandler

        default void URLSessionTaskWillPerformHTTPRedirectionNewRequestCompletionHandler​(NSURLSession session,
                                                                                         NSURLSessionTask task,
                                                                                         NSHTTPURLResponse response,
                                                                                         NSURLRequest request,
                                                                                         NSURLSessionTaskDelegate.Block_URLSessionTaskWillPerformHTTPRedirectionNewRequestCompletionHandler completionHandler)
        An HTTP request is attempting to perform a redirection to a different URL. You must invoke the completion routine to allow the redirection, allow the redirection with a modified request, or pass nil to the completionHandler to cause the body of the redirection response to be delivered as the payload of this request. The default is to follow redirections. For tasks in background sessions, redirections will always be followed and this method will not be called.
      • URLSessionTaskWillBeginDelayedRequestCompletionHandler

        default void URLSessionTaskWillBeginDelayedRequestCompletionHandler​(NSURLSession session,
                                                                            NSURLSessionTask task,
                                                                            NSURLRequest request,
                                                                            NSURLSessionTaskDelegate.Block_URLSessionTaskWillBeginDelayedRequestCompletionHandler completionHandler)
        Sent when the system is ready to begin work for a task with a delayed start time set (using the earliestBeginDate property). The completionHandler must be invoked in order for loading to proceed. The disposition provided to the completion handler continues the load with the original request provided to the task, replaces the request with the specified task, or cancels the task. If this delegate is not implemented, loading will proceed with the original request. Recommendation: only implement this delegate if tasks that have the earliestBeginDate property set may become stale and require alteration prior to starting the network load. If a new request is specified, the allowsExpensiveNetworkAccess, allowsContrainedNetworkAccess, and allowsCellularAccess properties from the new request will not be used; the properties from the original request will continue to be used. Canceling the task is equivalent to calling the task's cancel method; the URLSession:task:didCompleteWithError: task delegate will be called with error NSURLErrorCancelled.
      • URLSessionTaskIsWaitingForConnectivity

        default void URLSessionTaskIsWaitingForConnectivity​(NSURLSession session,
                                                            NSURLSessionTask task)
        Sent when a task cannot start the network loading process because the current network connectivity is not available or sufficient for the task's request. This delegate will be called at most one time per task, and is only called if the waitsForConnectivity property in the NSURLSessionConfiguration has been set to YES. This delegate callback will never be called for background sessions, because the waitForConnectivity property is ignored by those sessions.