Created
November 29, 2013 16:59
-
-
Save dodikk/7708728 to your computer and use it in GitHub Desktop.
Download to tmp file handling
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(void)URLSession:(NSURLSession *)session | |
downloadTask:(NSURLSessionDownloadTask *)downloadTask | |
didFinishDownloadingToURL:(NSURL *)location | |
{ | |
NSParameterAssert( nil != location ); | |
if ( self->_shouldCopyTmpFileToCaches ) | |
{ | |
JFFAsyncOperation asyncCopy = [ [ self class ] asyncCopyFileToCaches: location ]; | |
asyncCopy( nil, nil, ^void( NSURL* tmpFileInCaches, NSError* copyError ) | |
{ | |
[ self onSuccessfulDownloadToTmpFile: tmpFileInCaches | |
copyFileError: copyError ]; | |
} ); | |
} | |
else | |
{ | |
[ self onSuccessfulDownloadToTmpFile: location | |
copyFileError: nil ]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment