想要将图片上传到S3
,但会收到此错误:
图片上传出现故障:true filename:10211282278486891.photo错误: 可选(错误域= com.amazonaws.AWSS3ErrorDomain代码= 0“(null)” UserInfo = {RequestId = 6392E3155D770AF8,Bucket = something, HOSTID = Lc1RcDdY + lqdquZLWtd / + k5eexkpLtTWwSmsi3ZWDp / QFP2jNu + duXcOcX25IOkCR5t6ZzkIoIE =, 消息=必须解决您尝试访问的存储桶 使用指定的端点。请将所有未来的请求发送给此 endpoint。,Code = PermanentRedirect, 端点= something.s3.amazonaws.com})
有什么不对?
let transferManager = AWSS3TransferManager.default()
let uploadRequest = AWSS3TransferManagerUploadRequest()!
uploadRequest.bucket = "something"
uploadRequest.key = filename
uploadRequest.body = url
transferManager.upload(uploadRequest).continueWith(block: {task in
print("Image upload faulted: \(task.isFaulted) filename: \(filename) error: \(task.error)")
return nil
})