I upload a zip
file to a folder in my application. Watching download progress from 1% to 100% in my label
. After the label
= 100% I do not find the file in the folder. It appears after 50 seconds. How can I constantly check the presence of a file for 50 seconds in order to know the exact code it will appear in the folder?
boot code
-(IBAction) downloadButton:(id)sender { if (_HighScore == 2) { _url1 =[NSURL URLWithString:@"link2.zip"]; _downloadTask1 = [_session downloadTaskWithURL:_url1]; [_downloadTask1 resume]; } - (void)URLSession:(NSURLSession *)session downloadTask:(NSURLSessionDownloadTask *)downloadTask didFinishDownloadingToURL:(NSURL *)location { if (downloadTask == _downloadTask1) { _documentsDirectory1 = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; _zipPath1 = [_documentsDirectory1 stringByAppendingPathComponent:@"2.zip"]; } dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ if (downloadTask == _downloadTask1) { NSData *urlData1 = [NSData dataWithContentsOfURL:_url1]; [urlData1 writeToFile:_zipPath1 atomically:YES];} }); }
UPD
_documentsDirectory1 = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; _zipPath1 = [_documentsDirectory1 stringByAppendingPathComponent:@"2.zip"]; _destinationPath1 = [_documentsDirectory1 stringByAppendingPathComponent:@"MediaData"]; _fileExists1 = [[NSFileManager defaultManager] fileExistsAtPath:_zipPath1 isDirectory:false]; if( [SSZipArchive unzipFileAtPath:_zipPath1 toDestination:_destinationPath1] != NO ) { NSLog(@"Dilip Success"); }else{ NSLog(@"Dilip Error"); }