简体   繁体   English

AFNetworking 3-如何初始化NSProgress

[英]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.

相关问题 为什么在AFNetworking中使用点对点类型(NSProgress * __autoreleasing *)而不是仅使用点类型(NSProgress * __autoreleasing)? - Why using a point to point type(NSProgress * __autoreleasing *) rather than just a point type (NSProgress * __autoreleasing) in AFNetworking? 使用AFNetworking 2.0 + NSProgress + Custom ProgressView获取下载进度 - Getting Download progress with AFNetworking 2.0 + NSProgress + Custom ProgressView 如何使用/测试子NSProgress实例的NSProgress userInfo更改 - How to use/test NSProgress userInfo changes of a child NSProgress instance 如何并行跟踪两个NSProgress? - How to track two NSProgress in parallel? 如何为多个NSProgress使用observeValueForKeyPath? - How to use observeValueForKeyPath for several NSProgress? 如何在viewDidLoad之前在Swift中初始化AFNEtworking类 - How do I initialize an AFNEtworking class in Swift prior to viewDidLoad 使用afnetworking 3.0.4发生崩溃,[NSProgress setTotalUnitCount:],任何可以告诉我原因的人 - there is a crash use the afnetworking 3.0.4 , [NSProgress setTotalUnitCount:], anyone who can tell me the reason 如何在Swift中对NSProgress进行键值观察 - How to do Key-Value Observing for NSProgress in Swift 如何将AFNetworking 2.0+与旧的AFNetworking一起使用? - How to use AFNetworking 2.0+ with old AFNetworking? AFNetworking:如何将此标头请求转换为使用AFNetworking? - AFNetworking: How to convert this header request to use AFNetworking?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM