I had a strange problem with NSURLSession by the didFinishDownloadingToURL delegation method.
The first thing I do is to check if a temporary uploaded file exists:
- (void)URLSession:(NSURLSession *)session downloadTask:(NSURLSessionDownloadTask *)downloadTask didFinishDownloadingToURL:(NSURL *)location { if (![[NSFileManager defaultManager] fileExistsAtPath: [location path]]) { NSLog(@"Error. File not found"); return;
It works fine when the application is in the foreground and the download ends. But when the application is in the background and is forcibly killed by the operating system, it returns false.
Does anyone have an idea of ββwhat might happen? I know that there is a time limit for executing this delegate method when the application wakes up by the operating system since there is no temporary file for the temporary file. I canβt even copy it to another place ... Does it make sense to be due to file size? I upload a file + -130MB.
Thanks.
ios objective-c download nsurlsession
Guilherme gusman
source share