如何获得GET和AFNetworking 3.0的下载进度?

时间:2016-01-08 10:34:51

标签: ios swift afnetworking afnetworking-3

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

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,连接:Keep-Alive,Content-Type:application / json,日期:星期五,2016年1月8日12:34:00 GMT,Content-Encoding:gzip,Keep-Alive:timeout = 1, max = 100,Content-Length:5663,Vary:Accept-Encoding,User-Agent]

0 个答案:

没有答案