我调用以下代码来获取AWS表的DynamoDB凭据。
我的问题是1小时后我的权限到期,当我再次回想起这些例程时,它不会刷新我的凭据而无法访问数据库。
但如果我重新启动我的应用程序就可以了。
如何刷新而无需重新启动应用程序?
AWSCognitoCredentialsProvider *credentialsProvider = [[AWSCognitoCredentialsProvider alloc]
initWithRegionType:AWSRegionUSEast1
identityPoolId:@"us-east-1:*****************"];
//[credentialsProvider refresh];
//[AWSServiceManager initialize];
//[AWSServiceManager dealloc];
AWSServiceConfiguration *configuration = [[AWSServiceConfiguration alloc] initWithRegion:AWSRegionUSEast1 credentialsProvider:credentialsProvider];
[AWSServiceManager defaultServiceManager].defaultServiceConfiguration = configuration;
dynamoDBObjectMapper = [AWSDynamoDBObjectMapper defaultDynamoDBObjectMapper];