我正在从iCloud / Dropbox到我的iOS(Swift)应用程序中提取多个文件(docs / pdfs),然后尝试将它们上传到AWS。 我看过AWS文档,这些文档用于将文件一个接一个地上传到AWS(一次一次不多个)。
我正在尝试同时将多个文件上传到AWS。 我有包含多个document / pdfs路径的数组。
我已经在AWS documentation中看到了以下代码。
let uploadingFileURL = URL(fileURLWithPath: "your/file/path/myTestFile.txt")
let uploadRequest = AWSS3TransferManagerUploadRequest()
uploadRequest.bucket = "myBucket"
uploadRequest.key = "myTestFile.txt"
uploadRequest.body = uploadingFileURL
transferManager.upload(uploadRequest).continueWith(executor: AWSExecutor.mainThread(), block: { (task:AWSTask<AnyObject>) -> Any? in
if let error = task.error as? NSError {
if error.domain == AWSS3TransferManagerErrorDomain, let code = AWSS3TransferManagerErrorType(rawValue: error.code) {
switch code {
case .cancelled, .paused:
break
default:
print("Error uploading: \(uploadRequest.key) Error: \(error)")
}
} else {
print("Error uploading: \(uploadRequest.key) Error: \(error)")
}
return nil
}
let uploadOutput = task.result
print("Upload complete for: \(uploadRequest.key)")
return nil
})
如何继续执行此任务?