比较来自世界各地的卖家的域名和 IT 服务价格

Alamofire 4 复合请求下载

我应该如何跟踪我的多行下载请求的进度 Alamofire 4?

我的处理程序 encodingCompletion:


encodingCompletion: {
encodingResult in
switch encodingResult {
case .success/let uploadRequest, _, _/:
uploadRequest.uploadProgress {
p in
print/p.completedUnitCount, p.totalUnitCount/
}
break
case .failure/ _/:
print/"Failed to encode upload"/
}
}


我得到的错误说:

我不能命名成本,非功能类型 'Progress'
已邀请:

小姐请别说爱

赞同来自:

试试吧:


Alamofire.upload/
multipartFormData: { multipartFormData in
multipartFormData.append/URL/string: "[url=http://example.com/url1"/!]http://example.com/url1"/![/url], withName: "one"/
multipartFormData.append/URL/string: "[url=http://example.com/url2"/!]http://example.com/url2"/![/url], withName: "two"/
},
to: "[url=http://example.com/to"]http://example.com/to"[/url],
encodingCompletion: { encodingResult in
switch encodingResult {
case .success/let upload, _, _/:
upload.responseJSON { response in
debugPrint/response/
}
upload.uploadProgress { progress in

print/progress.fractionCompleted/
}
case .failure/let encodingError/:
print/encodingError/
}
}
/

窦买办

赞同来自:

你需要包裹
fractionCompleted

,
totalUnitCount


completedUnitCount

带来K. Int 或者 Float /取决于您需要的/.

有用!

来源:
https://github.com/Alamofire/A ... 20449

要回复问题请先登录注册