I am downloading a file at the user's request (hence, starting the download in the foreground). The download is quite large (1.2GB) and so the user may well close the app and get on with doing something else while the download is going on.
My app doesn't need to do anything with the downloaded file once it has finished arriving, other than to move it into the right place. From the app's point of view, this can be done next time the user opens it. From the app's point of view, there is no point in the system's launching the app into the background specifically in order to do this. From iOS's point of view, it saves resources not to launch an app unnecessarily. Moreover, there is the disadvantage of having a hard-to-test code path involved in the "silent launch in order to move the file into place". I like testability!
But before taking the decision to set
sessionSendsLaunchEvents=NO
in NSURLSessionConfiguration
, I need to know what the likely consequences are. Will nsurlsessiond
hold on to the downloaded file until the user opens my app again – perhaps the same time tomorrow – or is it likely to throw the file away, so that the whole download ends up needing to be done again?I can't find any documentation about this, which may be me, or may be the documentation. But any guidance will be appreciated. I know that this is meant to be an implementation detail, but in this case it does make a definite difference.