Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/20.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 如何获取get和AFNetworking 3.0的下载进度?_Ios_Swift_Afnetworking_Afnetworking 3 - Fatal编程技术网

Ios 如何获取get和AFNetworking 3.0的下载进度?

Ios 如何获取get和AFNetworking 3.0的下载进度?,ios,swift,afnetworking,afnetworking-3,Ios,Swift,Afnetworking,Afnetworking 3,有可能吗?我知道有一种方法: public func GET(URLString: String, parameters: AnyObject?, progress downloadProgress: ((NSProgress) -> Void)?, success: ((NSURLSessionDataTask, AnyObject?) -> Void)?, failure: ((NSURLSessionDataTask?, NSError) -> Void)?) ->

有可能吗?我知道有一种方法:

public func GET(URLString: String, parameters: AnyObject?, progress downloadProgress: ((NSProgress) -> Void)?, success: ((NSURLSessionDataTask, AnyObject?) -> Void)?, failure: ((NSURLSessionDataTask?, NSError) -> Void)?) -> NSURLSessionDataTask?
但是根本不调用
downloadProgress
块。我如何以其他方式实现这一点

这就是我在
AFHTTPSessionManager
的子类上调用方法的方式:

GET("words", parameters: nil, progress: { progress in

    print("---------- \(progress)") //not called

    }, success: { sessionDataTask, response in
        completionBlock(error) //this is called
    }) { sessionDataTask, error in
        completionBlock(error)
}
响应的标题:

[服务器:Apache,连接:保持活动,内容类型:application/json,日期:Fri,2016年1月8日12:34:00 GMT,内容编码:gzip,保持活动:超时=1,最大=100,内容长度:5663,变化:接受编码,用户代理]