I use this code to upload a file and see the process.
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *filePath = [documentsDirectory stringByAppendingPathComponent:@"Chapter1.mp3"]; dispatch_async(dispatch_get_main_queue(), ^{ NSString *stringURL = @"https://getfile.dokpub.com/yandex/get/https://yadi.sk/d/TfsCShdksCNR"; NSURL *url = [NSURL URLWithString:stringURL]; NSData *urlData = [NSData dataWithContentsOfURL:url]; [urlData writeToFile:filePath atomically:YES]; float progress = [urlData length]/(float)[urlData length]; [self.mainView.progressView setProgress:progress]; });
The problem is that the animation appears at the last second of the download. What needs to be done so that the animation takes place throughout the entire process?