증폭 사용자 지정 구성에 오류가 iOS 스

0

질문

내가 노력하고 통합하는 증폭 내 프로젝트가 어떤 문제로 구성되어 있습니다. 백엔드 보내 S3 스토리지 구성을 내는 프로젝트를 configurate 증폭과 데이터를 받았습니다. 나 configurate 저장소 다음과 같은 테스트는 그러나 그것의 실패와 함께 다음과 같은 오류가:

PluginError: Unable to decode configuration
Recovery suggestion: Make sure the plugin configuration is JSONValue
  ▿ pluginConfigurationError : 3 elements
    - .0 : "Unable to decode configuration"
    - .1 : "Make sure the plugin configuration is JSONValue"
    - .2 : nil

이것은 나의 코드:

func amplifyConfigure() {        
        do {
            Amplify.Logging.logLevel = .verbose
            
            try Amplify.add(plugin: AWSCognitoAuthPlugin())
            try Amplify.add(plugin: AWSS3StoragePlugin())

            let storageConfiguration = StorageCategoryConfiguration(
                        plugins: [
                            "awsS3StoragePlugin": [
                                "bucket": "bucket",
                                "region": "us-west-2",
                                "defaultAccessLevel": "protected"
                            ]
                        ]
                    )
            
            let amplifyConfiguration = AmplifyConfiguration(storage: storageConfiguration)
            try Amplify.configure(amplifyConfiguration)
            
            // LOG success.
        } catch {
            // LOG Error.
        }
    }

누군가의 도움을 받을 수 있는 나에게 이 사용자 정의 구성입니까? 감사합니다!

1

최고의 응답

0

그것 보다는 구성 선언할 수 없습 중 하나에 직접 가서 어떤 이유로,가능한 형식과 관련이 있습니다. 나를 위해 그것은 작동하는 경우 내가 그것을 선언에서 여러 단계가 있습니다. 를 교체하고 이:

let storageConfiguration = StorageCategoryConfiguration(
                        plugins: [
                            "awsS3StoragePlugin": [
                                "bucket": "bucket",
                                "region": "us-west-2",
                                "defaultAccessLevel": "protected"
                            ]
                        ]
                    )

이:

var storageConfigurationJson : [String:JSONValue] = [ "awsS3StoragePlugin" : [] ]
storageConfigurationJson["awsS3StoragePlugin"] = ["bucket": "bucket",
                                                  "region": "us-west-2",
                                                  "defaultAccessLevel": "protected"]
let storageConfiguration = StorageCategoryConfiguration(plugins: storageConfigurationJson)

나는 단지 사용을 증폭 config AuthCategoryConfiguration에서,그래서 케이스 StorageCategoryConfiguration 는 다른 문법을 조정해야 할 수 있습니다 내 제안 코드습니다.

2021-12-23 13:53:56

다른 언어로

이 페이지는 다른 언어로되어 있습니다

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................