Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/109.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone AFDownloadRequestOperation乘以每次下载的下载进度_Iphone_Ios_Nsurlconnection_Afnetworking_Uiprogressview - Fatal编程技术网

Iphone AFDownloadRequestOperation乘以每次下载的下载进度

Iphone AFDownloadRequestOperation乘以每次下载的下载进度,iphone,ios,nsurlconnection,afnetworking,uiprogressview,Iphone,Ios,Nsurlconnection,Afnetworking,Uiprogressview,我正在使用AFDownloadRequestOperation进行下载。我无法跟踪队列中每个下载的进度。我的进度条显示主线程上操作的进度(这是最后添加的请求)。参考了许多链接,但无法跟踪整个区块的进度。这是密码 for (int i =0; i<count; i++) { VideoClass *item1=[[VideoClass alloc]initWithVideo:[self.Downloads objectAtIndex:i]];

我正在使用
AFDownloadRequestOperation
进行下载。我无法跟踪队列中每个下载的进度。我的进度条显示主线程上操作的进度(这是最后添加的请求)。参考了许多链接,但无法跟踪整个区块的进度。这是密码

   for (int i =0; i<count; i++)
    {
        VideoClass *item1=[[VideoClass alloc]initWithVideo:[self.Downloads objectAtIndex:i]];

        NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:item1.URL]];

        NSString *videoTgtPath = [[[[VideoDBClass alloc] init] autorelease] getPathToVideoFile:[self.Downloads objectAtIndex:i]];

        AFDownloadRequestOperation *operation = [[AFDownloadRequestOperation alloc] initWithRequest:request targetPath:videoTgtPath shouldResume:YES];

        [operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
            NSLog(@"Successfully downloaded file to %@", videoTgtPath);

            if ([[[[VideoDBClass alloc] init] autorelease] completeDownload:item1 error:nil])
            {  

                NSLog(@"Successfully Moved ");

            }
            self.AllDownLoads = [[[[VideoDBClass alloc] init] autorelease] getVideos];
            [DownloadTblView reloadData];
        }
        failure:^(AFHTTPRequestOperation *operation, NSError *error)
         {
            NSLog(@"Error: %@", error);
        }];

        [operation setProgressiveDownloadProgressBlock:^(AFDownloadRequestOperation *operation1,NSInteger bytesRead, long long totalBytesRead, long long totalBytesExpected, long long totalBytesReadForFile, long long totalBytesExpectedToReadForFile)
         {
             totalBytesReadForFile =  self.DownloadComplete;
             totalBytesExpectedToReadForFile = self.DownloadSize;

            NSLog(@"the name of the operation is %@",operation1.request.URL.absoluteString);
            NSLog(@"Operation%i: bytesRead: %d", 1, bytesRead);
            NSLog(@"Operation%i: totalBytesRead: %lld", 1, totalBytesRead);
            NSLog(@"Operation%i: totalBytesExpected: %lld", 1, totalBytesExpected);
            NSLog(@"Operation%i: totalBytesReadForFile: %lld", 1, totalBytesReadForFile);
            NSLog(@"Operation%i: totalBytesExpectedToReadForFile: %lld", 1, totalBytesExpectedToReadForFile);

     // My PROGRESS View in the this section of the tableview and get updated by reloading this section But it shows the same progress for all downloads.

             [DownloadTblView reloadSections:[NSIndexSet indexSetWithIndex:1] withRowAnimation:UITableViewRowAnimationNone];

        }];
        //    [operation addObject:operation];
        [operation start];
    }
当他们为我的progressView设置值时。但我不知道如何跟踪每个过程的进展并显示出来。请帮帮我。

用于跟踪批次内的操作进度。当每个操作完成时,您可以增加进度块以反映它(例如,“完成5个或19个操作”)

跟踪所有操作的累积字节积累可能是不必要的;上述方法充分地将进度传达给用户

 totalBytesReadForFile =  self.DownloadComplete;
 totalBytesExpectedToReadForFile = self.DownloadSize;