2016-04-28 168 views
3

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

我下面的代码添加到AppDelegate.swift文件 //初始化亚马逊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`. 
+1

您没有通过Info.plist提供配置。相反,您正在使用'defaultServiceConfiguration'。您可以放心地忽略该消息。 –

+0

对不起,简短的回答,我不能评论由于低代表。我不确定这是你的情况,但是当我在我的应用程序中设置身份池时,我错过了该区域。您的应用委托中的identityPoolId也应包含它。请尝试:让credentialsProvider = AWSCognitoCredentialsProvider(regionType:AWSRegionType.USEast1,identityPoolId:“us-east-1:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx”) – valencieu

+0

Thaks for your comment ....我只是输入“mypoolid”作为一个例子 – RafterMan680

回答

0

我的问题是文件没有被上传到S3桶...有什么不对劲的凭证设置...在serviceConfiguration它在铲斗创建不正确的区域......一旦我改变了文件上传。