[英]AWS SDK iOS - how to determine the percentage completion of upload request
I'm trying to update a progress view as I upload an asset to an S3 bucket like so: 当我将资产上传到S3存储桶时,我正在尝试更新进度视图,如下所示:
myTransferManager.upload(myTransferManagerRequest).continueWithExecutor(myDefaultThreadBFExecutor, withBlock: { (myBFTask) -> AnyObject! in ... etc etc.
However, I can't figure out how to get the completion percentage of the request as it uploads. 但是,我不知道如何在上传请求时获得请求的完成百分比。 I have come across this delegate method a few times:
我几次遇到过这种委托方法:
-(void)request:(AmazonServiceRequest *)request didSendData:(NSInteger)bytesWritten totalBytesWritten:(NSInteger)totalBytesWritten totalBytesExpectedToWrite: (NSInteger)totalBytesExpectedToWrite
{
}
But my project is written in Swift and I haven't been able to figure out how to implement this. 但是我的项目是用Swift编写的,我还无法弄清楚如何实现这一点。 For reference, I came across that method here: http://mobile.awsblog.com/post/TxIRFEQTW9XU8G/S3TransferManager-for-iOS-Part-I-Asynchronous-Uploads and here: Uploading to Amazon-S3 via AFNetworking
作为参考,我在这里遇到了该方法: http : //mobile.awsblog.com/post/TxIRFEQTW9XU8G/S3TransferManager-for-iOS-Part-I-Asynchronous-Uploads ,在这里: 通过AFNetworking上传到Amazon-S3
any tips would be greatly appreciated! 任何提示将非常感谢!
Cheers, Brendan 干杯,布伦丹
AWSRequest
, which is a parent class of all AWS request objects, has properties called uploadProgress
and downloadProgress
. AWSRequest
是所有AWS请求对象的父类,其属性分别称为uploadProgress
和downloadProgress
。 You can use them to track the progress. 您可以使用它们来跟踪进度。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.