AWSS3TransferUtility background upload - disable cellular access (wi-fi only)

960 views Asked by At

Yo. I'm working with the AWS S3 SDK on iOS, and need to upload large files (videos).

Since they're large, I need the upload to continue while the app is in the background, suspended or terminated (AWSS3TransferUtility does the heavy lifting here).

Also, since they're large, I want to pause uploads when not connected to WiFi, and resume when reconnected. I believe this is the nature of an NSURLSession configured with allowsCellularAccess = NO.

Since I cannot, while the app is in background or terminated, watch reachability and manually pause/resume tasks, I expect this must be configured on the AWSS3TransferUtility, but alas have not found any means of doing so.

Does anyone know if this is possible, and how to achieve said goal?

Very much appreciated.

--

PS: Example code I'm working with is Amazon's example project: https://github.com/awslabs/aws-sdk-ios-samples/tree/master/S3BackgroundTransfer-Sample

Obj-c, iOS 9

1

There are 1 answers

3
fractious On BEST ANSWER

This is now possible, as of AWS SDK v2.3.6:

let credentialsProvider = AWSCognitoCredentialsProvider(regionType: myRegion, identityPoolId: myIdentityPoolId)
let configuration = AWSServiceConfiguration(region: myRegion, credentialsProvider: credentialsProvider)
configuration.allowsCellularAccess = false
AWSServiceManager.defaultServiceManager().defaultServiceConfiguration = configuration