我已经从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`.
答案 0 :(得分:0)
我的问题是文件没有上传到S3存储桶...凭据设置有问题...在serviceConfiguration中它有一个不正确的区域,其中创建了存储桶...一旦我更改该文件已上传。