I am trying to get the list of current upload tasks. For some reason when I call getUploadTasks on my AWSS3TransferUtility object I am being returned an AWSTask rather than an array of AWSS3TransferUtilityUploadTask objects as the documentation suggests here http://docs.aws.amazon.com/AWSiOSSDK/latest/Classes/AWSS3TransferUtility.html#//api/name/getAllTasks
Here is my code:
let transferUtility = AWSS3TransferUtility.defaultS3TransferUtility()
if let uploadTasks = transferUtility?.getUploadTasks() {
//uploadTasks is an AWSTask object rather than an array of AWSS3TransferUtilityUploadTask objects
for uploadTask in uploadTasks {
print("uploadTask")
}
}
You need to use - continueWithBlock: and retrieve the list of tasks from task.result. See Working with AWSTask for more details.
Not sure what is in task.result because it is an any object... can't seem to find class reference for awstask either.
Edit: Essentially I just need to retrieve a list of the keys synchronously that are currently uploading.
Got this working! For anyone trying to do something similar this is what it looks like:
let transferUtility = AWSS3TransferUtility.defaultS3TransferUtility()
transferUtility?.getUploadTasks().continueWithBlock({
(task) in
print("getUploadTasks ContinueBlock")
if let uploadTasks = task.result as? [AWSS3TransferUtilityUploadTask] {
}
return nil
})
Most helpful comment
Got this working! For anyone trying to do something similar this is what it looks like: