Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/96.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
Ios UIProgressView+AFNetworking未更新进度_Ios_Afnetworking 2_Uiprogressview - Fatal编程技术网

Ios UIProgressView+AFNetworking未更新进度

Ios UIProgressView+AFNetworking未更新进度,ios,afnetworking-2,uiprogressview,Ios,Afnetworking 2,Uiprogressview,我正在尝试使用AFNetworking UIKit中的UIProgressView+AFNetworking类别。 我有一个将照片上传到服务器的操作。一次拍摄多张照片。但是我的进度视图根本没有更新 在我看来,我使用 [progressView setProgressWithUploadProgressOfOperation:operation animated:YES]; 我的要求是: AFHTTPRequestOperation *operation = [manag

我正在尝试使用AFNetworking UIKit中的UIProgressView+AFNetworking类别。 我有一个将照片上传到服务器的操作。一次拍摄多张照片。但是我的进度视图根本没有更新

在我看来,我使用

[progressView setProgressWithUploadProgressOfOperation:operation animated:YES];
我的要求是:

    AFHTTPRequestOperation *operation =
        [manager POST:url parameters:params constructingBodyWithBlock:^(id<AFMultipartFormData> formData) {
            [formData appendPartWithFileData:imageData name:@"imageFile" fileName:fileName mimeType:[NSString stringWithFormat:@"image/%@",fileMime]];
            NSLog(@"Uploading...");
            [SVProgressHUD showWithStatus:@"Uploading File..."];

        } success:^(AFHTTPRequestOperation *operation, id responseObject) {
            //Success

        } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
            //Fail
            [manager.operationQueue cancelAllOperations];

        }];
试试这个:

[operation setDownloadProgressBlock:^(NSUInteger bytesRead, long long totalBytesRead, long long totalBytesExpectedToRead){
        double progress = (double)totalBytesRead / totalBytesExpectedToRead;
        NSLog(@"Progress: %.2f", progress);
        // ...
    }];
我有自己的进度条,所以我在setDownloadProgressBlock中更改它的值