【问题标题】:AWS SDK iOS - how to determine the percentage completion of upload requestAWS SDK iOS - 如何确定上传请求的完成百分比
【发布时间】:2014-12-26 04:03:25
【问题描述】:

我正在尝试在将资产上传到 S3 存储桶时更新进度视图,如下所示:

myTransferManager.upload(myTransferManagerRequest).continueWithExecutor(myDefaultThreadBFExecutor, withBlock: { (myBFTask) -> AnyObject! in ... etc etc. 

但是,我不知道如何在请求上传时获取完成百分比。我遇到过几次这种委托方法:

-(void)request:(AmazonServiceRequest *)request didSendData:(NSInteger)bytesWritten     totalBytesWritten:(NSInteger)totalBytesWritten totalBytesExpectedToWrite:    (NSInteger)totalBytesExpectedToWrite
{

}

但是我的项目是用 Swift 编写的,我还没有弄清楚如何实现它。作为参考,我在这里遇到了这种方法:http://mobile.awsblog.com/post/TxIRFEQTW9XU8G/S3TransferManager-for-iOS-Part-I-Asynchronous-Uploads 和这里:Uploading to Amazon-S3 via AFNetworking

任何提示将不胜感激!

干杯, 布伦丹

【问题讨论】:

    标签: ios swift amazon-web-services amazon-s3 progress-bar


    【解决方案1】:

    AWSRequest 是所有 AWS 请求对象的父类,具有称为 uploadProgressdownloadProgress 的属性。您可以使用它们来跟踪进度。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-03-05
      • 2014-04-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多