I'd like to set permissions for the files I'm uploading to S3 to be "Read" for All users, but can't find the way to use AWSS3PutObjectRequest grantRead
neither AWSS3Permission AWSS3PermissionRead
.
Any suggestion how to solve the problem?
Here's my code:
let uploadRequest = AWSS3TransferManagerUploadRequest()
uploadRequest.body = NSURL(fileURLWithPath: filePath)
uploadRequest.key = fileName
uploadRequest.bucket = S3BucketName
uploadRequest.grantFullControl = "All users" // I think here's an error
self.upload(uploadRequest)
When I comment out the line uploadRequest.grantFullControl = "All users"
the file gets uploaded, but the privilege for All users is set to None. I think the problem is in the penultimate line in the above code. When the line is not commented out I get this error:
upload() failed: [Error Domain=com.amazonaws.AWSS3ErrorDomain Code=0 "The operation couldn’t be completed. (com.amazonaws.AWSS3ErrorDomain error 0.)" UserInfo=0x191a5bc0 {HostId=xxx+xxxxxxx/14=, ArgumentValue=All users, Message=Argument format not recognized, ArgumentName=x-amz-grant-full-control, Code=InvalidArgument, RequestId=xxxx}]
EDIT: The code above actually tries to grant full control permissions but the core problem is the same. Also I've added an image showing privileges for uploaded file:
Aucun commentaire:
Enregistrer un commentaire