ios - AWS SDK S3 上传凭证

标签 ios swift amazon-web-services amazon-s3 sdk

我已遵循 AWS 的本教程 (http://docs.aws.amazon.com/mobile/sdkforios/developerguide/setup.html) 使用 swift 和 xcode 设置 AWS sdk iOS 9 应用程序。我正在尝试将文件上传到 S3 存储桶。

我在 AppDelegate.swift 文件中添加了以下代码 //初始化 Amazon Cognito 凭证提供程序

let credentialsProvider = AWSCognitoCredentialsProvider(regionType:.USEast1,identityPoolId:"mypoolid")

let configuration = AWSServiceConfiguration(region:.USEast1, credentialsProvider:credentialsProvider)

AWSServiceManager.defaultServiceManager().defaultServiceConfiguration = configuration

我还在 Info.plist 文件中包含了代码片段

<key>NSAppTransportSecurity</key>
<dict>
<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>

但是我得到了这个错误。如果它要我将凭据放入 Info.plist,我该怎么做?...或者我做错了什么?预先感谢您的帮助。

AWSServiceInfo initWithInfoDictionary:checkRegion:] | 
Couldn't read credentials provider configurations from `Info.plist`. 
Please check your `Info.plist` if you are providing the SDK configuration values through `Info.plist`.

最佳答案

我的问题是文件没有上传到 S3 存储桶...凭证设置有问题...在 serviceConfiguration 中创建存储桶的区域不正确...一旦我更改了文件已上传。

关于ios - AWS SDK S3 上传凭证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36924130/

相关文章:

iOS11 - Realm 框架未构建

swift - 自定义 UIImageView 边框

ios - Swift:暂停沿路径移动的动画?

PHP AWS SNS SDK - 徽章

amazon-web-services - cloudformation,创建更改时出错 : set Parameter 'ami' must be one of AllowedValues

amazon-web-services - AWS 部署环境并为开发和生产创建环境

iphone - Objective-C : Comparing CGPoints

iOS 8 Alertview 操作按钮颜色为白色

ios - UIImageView 不恢复到原始框架

ios - 如何在 iOS 中显示自定义嵌套列表