Aws-sdk-ios: Completion block is called for transfers that were started while offline after the app is force quit

Created on 8 Oct 2018  路  7Comments  路  Source: aws-amplify/aws-sdk-ios

Describe the bug
I am seeing if you start an upload transfer while offline, then you force quit the app and reopen it, the task's completion block is called with a nil error and the task's status is 3 (AWSS3TransferUtilityTransferStatusCompleted). This occurs because in didFinishLaunchingWithOptions I register the AWSS3TransferUtility and in that completion block I reassign the progress and completion blocks for the upload tasks.

To Reproduce
Steps to reproduce the behavior:

  1. Take your phone offline
  2. Start an upload
  3. Force quit the app
  4. Rerun it

Which AWS service(s) are affected?
AWSS3TransferUtility

Expected behavior
I expected the transfer tasks to have a status of unknown, so the completion block wouldn't be called, and I would have to retry uploading them as new upload tasks, which is the behavior I see when starting the upload while online.

Environment:

  • SDK Version: 2.6.31
  • Dependency Manager: Cocoapods
  • Swift Version : 4.2

Device Information:

  • Device: iPhone 6 Plus
  • iOS Version: 10.3.2
bug pending investigation s3

All 7 comments

@hipwelljo
I will take a look at this and post an update with my findings. One question I have is - can you check on the server side if the file got uploaded successfully?

Thanks @cbommas! No, it would not be possible to have been uploaded successfully since the device was offline the entire time.

@cbommas Have you been able to take a look at this issue?

@hipwelljo
I was able to reproduce this issue. l will have an update for you in the next few days

@hipwelljo

Just a quick update - I have a fix for this that I am currently testing. Will post back after I finish my testing and get the fix into the release pipeline.

@hipwelljo
The latest rev of the SDK 2.6.34 contains the fix for this issue. With this fix, when the app is force closed, the NSURLSession task associated with the transfer is canceled by the OS and the TransferUtility Task will move to an Error status.

Please give this a try and let me know how it goes.

Confirmed this is working, thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dougboberg picture dougboberg  路  5Comments

minhthuc251 picture minhthuc251  路  4Comments

anbarasu0504 picture anbarasu0504  路  3Comments

mackoj picture mackoj  路  5Comments

motivus picture motivus  路  4Comments