2015-10-26 37 views
0

訪問AWS S3得到異常:無法從Android

Unable to execute HTTP request: Unable to resolve host "cognito-identity.eu-central-1.amazonaws.com": No address associated with hostname 
Unable to resolve host "cognito-identity.eu-central-1.amazonaws.com": No address associated with hostname 

的代碼如下:

 // Initialize the Amazon Cognito credentials provider 
     CognitoCachingCredentialsProvider credentialsProvider = new CognitoCachingCredentialsProvider(
       getApplicationContext(), // Application Context 
       getResources().getString(R.string.AWS_IdentityPoolId), // Identity Pool ID 
       Regions.EU_CENTRAL_1 // Region enum 
     ); 

回答

1

這是 「公正」 地區問題。因爲我的Cognito在愛爾蘭,而我在法蘭克福的桶,混亂很容易。所以你可能對地區很在意。在可能的情況下:

// Initialize the Amazon Cognito credentials provider 
CognitoCachingCredentialsProvider credentialsProvider = new CognitoCachingCredentialsProvider(
     getApplicationContext(), // Application Context 
     getResources().getString(R.string.AWS_IdentityPoolId), // Identity Pool ID 
     Regions.EU_WEST_1 // Region enum 
); 
1

僅供參考Cognit Identity在EU_CENTRAL_1(法蘭克福)尚未提供。結帳AWS Service Region Availability。像安東尼說的那樣,Cognit Identity不必與其他服務位於同一區域。請始終選擇靠近您的地區以獲得更好的體驗。