My intuition is that we're not handling network errors well. So you probably had an error when Alcatraz downloaded the gif (which is quite large), and we cached it anyway.
This PR fixes that, and should somewhat improve performances (see below):
Check for the error parameter in URLSession:task:didCompleteWithError: to handle client side errors;
Check for the HTTP response status code, and return an NSError for any code other than 200;
Replace NSURLSessionDownloadTask with NSURLSessionDataTask, so the downloaded files are never written to disk (since we always loaded them in memory anyway);
Remove strong references to callbacks after task completion.
As discussed in https://github.com/alcatraz/Alcatraz/issues/479, we didn't handle errors very well in ATZDownloader.
This PR fixes that, and should somewhat improve performances (see below):
error
parameter inURLSession:task:didCompleteWithError:
to handle client side errors;