有可能吗?我知道有一种方法:
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]