我正在通过 AFNetwork 使用 AFDownloadRequestOperation 下载一个大文件,并希望在一些延迟或时间间隔后调用setProgressiveDownloadProgressBlock 。考虑到下面的代码,我该怎么做?
__weak MTCViewController *weakSelf= self;
[_operation setProgressiveDownloadProgressBlock:^(AFDownloadRequestOperation *operation,
NSInteger bytesRead, long long totalBytesRead, long long totalBytesExpected, long long
totalBytesReadForFile, long long totalBytesExpectedToReadForFile) {
[weakSelf performSelectorOnMainThread:@selector(updateText:) withObject:[NSString stringWithFormat:@"Progress = %i",percent] waitUntilDone:YES];
}
因为我希望这个函数在一段时间后更新数据,而不是在一秒钟内数千次