0
votes

I am facing issue for permission while uploading the image to s3 bucket from my ios code. I am able to upload it on s3 bucket. but how can i upload the image with public permission on s3 bucket so i can read/view the image .I tried as below but its shows me as deprecated. I attached the screenshot as well

if let _ = task.result {
DispatchQueue.main.async {
print("Thumb Image Upload Starting!")
let request = AWSS3PutObjectAclRequest()
request?.bucket = self.bucketName
request?.key = keyName
request?.acl = AWSS3ObjectCannedACL.publicReadWrite
let s3Service = AWSS3.default()
s3Service.putObjectAcl(request!)
}
}

enter image description here

1

1 Answers

1
votes

To view images from S3, the best approach is to use a presigned URL instead of making it public.

To do so, you can follow the instructions on this link: https://github.com/awsdocs/aws-mobile-developer-guide/blob/master/doc_source/how-to-ios-s3-presigned-urls.rst