AWSS3 Region / plist configuration issue 'The service configuration is `nil`

后端 未结 5 1722
梦毁少年i
梦毁少年i 2020-12-19 01:10

I am facing a strange issue with AWSS3.

Setup:

  • AWS Mobile HUB
  • Cognito
  • DynamoDB
  • S3

--> Cognito, Dynamo & e

相关标签:
5条回答
  • 2020-12-19 01:23

    Your info.plist needs to have S3TransferManager in it.

    So, **AWS -> S3TransferManager -> Default -> Region -> ...**

    You can find an example of one here

    0 讨论(0)
  • 2020-12-19 01:25

    For me, I had to configure the credentials with the following code, before uploading:

    let credentialsProvider = AWSCognitoCredentialsProvider(regionType:.USEast1,identityPoolId:PoolID)
    let configuration = AWSServiceConfiguration(region:.USEast1, credentialsProvider:credentialsProvider)
    
    AWSServiceManager.default().defaultServiceConfiguration = configuration
    

    Where PoolID is my Cognito identity. I hope this helps others.

    0 讨论(0)
  • 2020-12-19 01:34

    The problem was, region should be:

    us-east-1
    

    Instead of; US_EAST_1

    0 讨论(0)
  • 2020-12-19 01:36

    I had the same issue instead of S3TransferManager you should put DynamoDBObjectMapper

    e.g..

    <key>DynamoDBObjectMapper</key>
        <dict>
            <key>Default</key>
            <dict>
                <key>Region</key>
                <string>us-east-1</string>
            </dict>
        </dict>
    
    0 讨论(0)
  • 2020-12-19 01:43

    Swift 3 - Xcode 8.3.3

    For people still having this issue, I just spent 3h fighting against this annoying setup issue.

    I added both these chunks in my Info.plist (replace the variables between ** ** in the second bloc) and now it's working again.

    Amazon's documentation isn't updated properly I think. I hope this can save some people some time.

    <key>NSAppTransportSecurity</key>
        <dict>
            <key>NSAllowsArbitraryLoads</key>
            <true/>
            <key>NSExceptionDomains</key>
            <dict>
                <key>amazonaws.com</key>
                <dict>
                    <key>NSThirdPartyExceptionMinimumTLSVersion</key>
                    <string>TLSv1.0</string>
                    <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
                    <false/>
                    <key>NSIncludesSubdomains</key>
                    <true/>
                </dict>
                <key>amazonaws.com.cn</key>
                <dict>
                    <key>NSThirdPartyExceptionMinimumTLSVersion</key>
                    <string>TLSv1.0</string>
                    <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
                    <false/>
                    <key>NSIncludesSubdomains</key>
                    <true/>
                </dict>
            </dict>
        </dict>
    

    and:

    <key>AWS</key>
        <dict>
            <key>CredentialsProvider</key>
            <dict>
                <key>CognitoIdentity</key>
                <dict>
                    <key>Default</key>
                    <dict>
                        <key>PoolId</key>
                        <string>**YourCognitoIdentityPoolId**</string>
                        <key>Region</key>
                        <string>**AWSRegionUnknown**</string>
                    </dict>
                </dict>
            </dict>
            <key>S3TransferManager</key>
            <dict>
                <key>Default</key>
                <dict>
                    <key>Region</key>
                    <string>**AWSRegionUnknown**</string>
                </dict>
            </dict>
        </dict>
    
    0 讨论(0)
提交回复
热议问题