How to get a response from NSURLSessionDownloadTask downloadTaskWithRequest


Some background first:
Application is supposed to grab files from AWS S3 server. In order to do that, first step of that process is to go to local server and get the name of the file and some other information from it. After that step we have a complete URLMutableRequest.

NOTE: I am setting up the NSURLSession as a background session:

This is the task to download the files from AWS S3 server:

for this task I want to use the delegates to run in background mode.

How to I get a RESPONSE form this REQUEST?

Apple documentation says you can’t have a block as completionHandler when using a backgroundSessionConfiguration.


NSURLSessionDownloadTask has a response property (part of its base class, NSURLSessionTask) that should be set to the response. See here.

Leave a Reply