Использование AWS S3 SDK (через Cocoapods) v2.8.0, но я не могу загрузить его из подпапки в корзине.Код прекрасно работает для загрузки в корне корзины
func downloadData(imageName: String, completion: @escaping (Bool) -> () ) {
let expression = AWSS3TransferUtilityDownloadExpression()
expression.progressBlock = {(task, progress) in DispatchQueue.main.async(execute: {
print("Download in process: \(progress.fractionCompleted*100)% complete")
})
}
var completionHandler: AWSS3TransferUtilityDownloadCompletionHandlerBlock?
completionHandler = { (task, URL, data, error) -> Void in
DispatchQueue.main.async(execute: {
if let error = error?.localizedDescription {
print("Error in completion of download: \(error)")
}
print("Completion Response: \(task.response)")
if let responseData = data {
if let image = UIImage.init(data: responseData) {
self.saveImage(imageName: imageName, image: image)
completion(true)
}
}
completion(false)
})
}
transferUtility.downloadData(
fromBucket: "myBucketName",
key: "mySubFolder/" + imageName,
expression: expression,
completionHandler: completionHandler
).continueWith {
(task) -> AnyObject? in if let error = task.error {
print("Error: \(error.localizedDescription)")
}
if let _ = task.result {
}
return nil;
}
}
Я получаю 404 с вышеуказанным кодом и следующей ошибкой.
Error in completion of download: The operation couldn’t be completed. (com.amazonaws.AWSS3TransferUtilityErrorDomain error 2.)