问题描述
得到异常:
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在爱尔兰,而我的Bucket在弗兰克福特,所以很容易混淆。 因此,您可能会在区域上保持谨慎。 在可能的情况下:
// 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
);
2楼
仅供参考,EU_CENTRAL_1(法兰克福)尚无法使用Cognito身份。 检出 。 就像Anthony所说的那样,Cognito身份不必与其他服务位于同一地区。 请始终选择靠近您的区域,以获得更好的体验。