iOS aws sdk v2 resume issue append data

106 Views Asked by At

Hi I'm using aws sdk v2

for download I'm using ASWSS3Transfermanager and AWSS3TransferManagerDownloadRequest

problem scenario is as follows:

  1. user download file.
  2. file total size is 500MB but user download until 200MB and exit app.
  3. Check the result 200MB file remains well.
  4. relaunch app and start download same file, aws sdk start download since 0MB.

How can i download file since 200MB?? Is there a way to save AWSS3TransferManagerDownloadRequest??

please help me..

1

There are 1 best solutions below

0
On

While the app relaunched, If you re-create the AWSS3TransferManagerDownloadRequest again (even with same parameters) and create a download task viaASWSS3TransferManager, your previously download task will be lost and new download will be initialized.

To resume your previously download, there are two options:

  1. When the app relaunched, call the resumeAll instead of recreating a new AWSS3TransferManagerDownloadRequest:

[AWSS3TransferManager resumeAll:nil] continueWithBlock:^id(AWSTask *task) { //process your task.result }];

  1. Using AWSS3TransferUtility instead of AWSS3TransferManager in latest AWS Mobile SDK for iOS. The AWSS3TransferUtility will utilize Apple's Background Transfer feature so that the download task will continue even the app has been shutdown.