2016-04-28 164 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它在剷鬥創建不正確的區域......一旦我改變了文件上傳。