0

I have called the below method to upload data on Amplify storage.

private func uploadData(filename: String?, data: Data?) {
    let dataString = "Example file contents"
    let data = dataString.data(using: .utf8)!
    Amplify.Storage.uploadData(key: "ExampleKey", data: data,
        progressListener: { progress in
            print("Progress: \(progress)")
        }, resultListener: { (event) in
            switch event {
            case .success(let data):
                print("Completed: \(data)")
            case .failure(let storageError):
                print("Failed: \(storageError.errorDescription). \(storageError.recoverySuggestion)")
        }
    })
}

It is giving me error in logs:

Failed: There is no user signed in to retreive identity id. Call Auth.signIn to sign in a user or enable unauthenticated access in AWS Cognito Identity Pool

I guess it is because I've set

"Who should have access: (Use arrow keys) ❯ Auth users only "

while setting up the storage. I need to have Auth & guests both. So I can upload without signing. How can I change this access?

Reference: https://docs.amplify.aws/lib/storage/getting-started/q/platform/ios#provision-backend-storage

Krutika Sonawala
  • 1,065
  • 1
  • 12
  • 30

1 Answers1

1

Use the amplify update storage command to update the storage configuration.