首先,我只需按照给定的指令访问DynamoDB, 之后,我构建了名为 DynamoDBObjectMapper-Sample 的下载示例项目,我收到了错误日志 -
错误:错误Domain = com.amazonaws.AWSCognitoIdentityErrorDomain Code = 8“(null)”UserInfo = {__ type = NotAuthorizedException,message =此身份池不支持未经身份验证的访问。}
执行以下代码后打印此错误 -
UIApplication.shared.isNetworkActivityIndicatorVisible = true
let dynamoDBObjectMapper = AWSDynamoDBObjectMapper.default()
let queryExpression = AWSDynamoDBScanExpression()
queryExpression.exclusiveStartKey = self.lastEvaluatedKey
queryExpression.limit = 20
dynamoDBObjectMapper.scan(DDBTableRow.self, expression: queryExpression).continueWith(executor: AWSExecutor.mainThread(), block: { (task:AWSTask!) -> AnyObject! in
if self.lastEvaluatedKey == nil {
self.tableRows?.removeAll(keepingCapacity: true)
}
if let paginatedOutput = task.result {
for item in paginatedOutput.items as! [DDBTableRow] {
self.tableRows?.append(item)
}
self.lastEvaluatedKey = paginatedOutput.lastEvaluatedKey
if paginatedOutput.lastEvaluatedKey == nil {
self.doneLoading = true
}
}
UIApplication.shared.isNetworkActivityIndicatorVisible = false
self.tableView.reloadData()
if let error = task.error as NSError? {
print("Error: \(error)")
}
return nil
})
所以请帮我设置身份验证密钥 -