Estoy tratando de cargar un archivo a S3 usando:
func uploadImage(with data: Data) { let expression = AWSS3TransferUtilityUploadExpression() expression.progressBlock = progressBlock transferUtility.uploadData( data, bucket: "MyBucket", key: "img.jpg", contentType: "image/jpeg", expression: expression, completionHandler: completionHandler).continueWith { (task) -> AnyObject! in if let error = task.error { print("Error: \(error.localizedDescription)") self.statusLabel.text = "Failed" } if let _ = task.result { self.statusLabel.text = "Generating Upload File" print("Upload Starting!") // Do something with uploadTask. } return nil; } } self.uploadImage(with: imageData)Veo esto en mi consola: ¡Carga comenzando! Pero el archivo nunca se carga.
Permisos de depósito:
{ "Version": "2008-10-17", "Statement": [ { "Sid": "AddPerm", "Effect": "Allow", "Principal": "*", "Action": "s3:GetObject", "Resource": "arn:aws:s3:::myBucket/*" } ] }política oneClick_Cognito_MyUserUnauth_Role_xxxxxx:
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "mobileanalytics:PutEvents", "cognito-sync:*", "s3:*" ], "Resource": [ "*" ] } ] } Recibo el error: Domain=com.amazonaws.AWSS3TransferUtilityErrorDomain Code=2