0

我在我的 iOS 应用程序中使用 AFNetworking。我需要显示进度条来显示下载进度。我打算使用方法 - setProgressiveDownloadProgressBlock 并使用 totalBytesExpected 来了解文件的总大小。但是,当我针对 Azure CDN URL 尝试此操作时,它会为 totalBytesExpected 和 totalBytesExpectedToReadForFile 返回 -1。我可以看到其他变量的值 - bytesRead、totalBytesRead 等。您能告诉我如何在这种情况下显示进度对话框吗?

    [operation1 setProgressiveDownloadProgressBlock:^(AFDownloadRequestOperation *operation, NSInteger bytesRead, long long totalBytesRead, long long totalBytesExpected, long long totalBytesReadForFile, long long totalBytesExpectedToReadForFile) {
                             totalBytesRead = ((totalBytesRead *100)/totalBytesExpectedToReadForFile);
////// Sending Notification about progress
    }];
4

0 回答 0