[英]AFNetworking 3 - How initialize NSProgress
I'm using AFNetworking 3.1.0 and GET:parameters:success:failure is deprecated
so I want to use GET:parameters:progress:success:failure
which is not. 我正在使用AFNetworking 3.1.0,并且
GET:parameters:success:failure is deprecated
使用GET:parameters:progress:success:failure
,所以我想使用的不是GET:parameters:progress:success:failure
。
- (NSURLSessionDataTask *)GET:(NSString *)URLString
parameters:(id)parameters
progress:(void (^)(NSProgress * _Nonnull))downloadProgress
success:(void (^)(NSURLSessionDataTask * _Nonnull, id _Nullable))success
failure:(void (^)(NSURLSessionDataTask * _Nullable, NSError * _Nonnull))failure
According to docs progress should be not null so I wonder how can I NSProgress object and make a simple GET request to a REST API. 根据文档,progress应该不为null,所以我想知道如何NSProgress对象并向REST API发出简单的GET请求。
You don't have to create any progress object for that. 您不必为此创建任何进度对象。 But you will get the progress of your downloading inside this block.
但是您将在此块中获得下载进度。 So you can calculate download progress and display it as per your requirement by creating progress indicator.
因此,您可以通过创建进度指示器来计算下载进度并根据需要显示它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.