skip to Main Content

When I am trying to send my image to aws using amplify plugin, I am having this problem on my iOS device 18 beta for else previous version its work fine:

 StorageAccessDeniedException {
 
User contributions licensed under CC BY-SA (content policy)

   "message": "S3 access denied when making the API call.",
   "recoverySuggestion": "HTTP error returned from service, review the `underlyingException` for details.",
   "underlyingException": "Instance of 'UnknownSmithyHttpException'"
 }

I am currently having the latest flutter version 3.24.2 and amplify_flutter: ^2.4.1, amplify_auth_cognito: ^2.4.1, amplify_storage_s3: Using ^2.4.1

2

Answers


  1. Chosen as BEST ANSWER
    Future<double> amplifyUpload() async{
        double progressbar = 0.0;
        try {
          var respOrg = await Amplify.Storage.uploadFile(
           localFile: AWSFile.fromPath('/path/to/local/file.txt'),
           path: const StoragePath.fromString('public/example.txt'),
            onProgress: (progress) {
              progressbar = progress.fractionCompleted;
              safePrint('Fraction completed: ${progress.fractionCompleted}');
            },
          ).result;
          safePrint('Uploaded file: ${respOrg.uploadedItem.path}');
        } on Exception catch (e) {
          debugPrint('Exception occurred: $e');
          progressbar = -1.0;
        }
        return progressbar;
      }
    

  2. You want to interact with Amazon S3 from a IOS app. Why are you not using the AWS SDK for Swift for developing IOS apps?

    https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/swift

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search