My requirement is to cancel upload when ever user wishes. I'm following TransferUtility document to setup and upload video, show progress, retains state even if app is in background. I couldn't find any way to cancel the uploadTask.
{
let uploadRequest = AWSS3TransferManagerUploadRequest()
let transferUtility = AWSS3TransferUtility.default()
var completionHandler : AWSS3TransferUtilityUploadCompletionHandlerBlock?
var uploadTask : AWSTask<AWSS3TransferUtilityUploadTask>?
let expression = AWSS3TransferUtilityUploadExpression()
}
func startUpload() {
uploadTask = transferUtility.uploadFile((uploadRequest?.body)!,
bucket: (uploadRequest?.bucket)!,
key: (uploadRequest?.key)!,
contentType: "video/mov",
expression: expression,
completionHander: completionHandler).continue({ (task) -> AnyObject! in if let error = task.error {
print("Error: \(error.localizedDescription)")
}
if let _ = task.result {
}
return nil;
}) as? AWSTask<AWSS3TransferUtilityUploadTask>
}
I want to know which continue block i should use on the task and how to perform something like uploadTask.cancel() just the way we use for TransferManager task.