AFNetworking/AFNetworking — pull request #2050 by mediabounds (2014-05-08 05:29:32+00:00)
Title: Provides a default temporary file for default download task delegate

When the session manager initializes, it provides a default delegate for any download tasks already in progress. By setting this default delegate, it doesn't give the application a way to provide the destination (at least that I could find) of the downloaded file.

Ideally, in cases where the default delegate is at work, applications would be able to respond to the task completion (via AFNetworkingTaskDidCompleteNotification) and move the temporary file to it's proper location. However, since the default download task delegate doesn't move the temporary file, that file gets [removed by NSURLSession on the return on -URLSession:downloadTask:didFinishDownloadingToURL:](https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSURLSessionDownloadDelegate_protocol/Reference/Reference.html#//apple_ref/occ/intfm/NSURLSessionDownloadDelegate/URLSession:downloadTask:didFinishDownloadingToURL:).

This gives the default download task delegate a default temporary file that won't get cleaned up until the task has finished calling all it's completion handlers.