指定了散列和范围,但它认为一个是空的?还是在谈论其他一些属性?
返回的task.result()为nil,task.error()表示:
“Error Domain = com.amazonaws.AWSDynamoDBErrorDomain Code = 0”提供 AttributeValue为空,必须包含其中一个支持的 数据类型“UserInfo = 0x7ff3c0e21d40 {NSLocalizedDescription =提供 AttributeValue为空,必须包含其中一个支持的 数据类型}“
我确信哈希和范围名称是正确的,表名也是正确的。
在Swift中写道,这是我的代码:
var venueIdAttribute = AWSDynamoDBAttributeValue()
venueIdAttribute.N = "2164156"
var venueIdCondition = AWSDynamoDBCondition()
venueIdCondition.comparisonOperator = .EQ // Hash Key must always be Equals
venueIdCondition.attributeValueList = [venueIdAttribute]
var startDateAttribute = AWSDynamoDBAttributeValue()
var startString = String(format:"%1.0f", lastSyncDate.timeIntervalSince1970 * 1000)
startDateAttribute.N = String(format:"%1.0f", lastSyncDate.timeIntervalSince1970 * 1000)
var dateCondition = AWSDynamoDBCondition()
dateCondition.comparisonOperator = .GT
dateCondition.attributeValueList = [startDateAttribute];
var keysArray : NSArray = [["venueId" : venueIdCondition, "dateInterval" : dateCondition]]
var keysAndAttributes : AWSDynamoDBKeysAndAttributes = AWSDynamoDBKeysAndAttributes()
keysAndAttributes.keys = keysArray;
var requestMap : NSDictionary = ["myTableName":keysAndAttributes]
var request : AWSDynamoDBBatchGetItemInput = AWSDynamoDBBatchGetItemInput()
request.requestItems = requestMap
var response : BFTask = dynamoDB.batchGetItem(request) // This is synchronous
答案 0 :(得分:3)
keysArray
在代码段中格式不正确。您正在创建NSString
:AWSDynamoDBCondition
字典,但它必须是NSString
:AWSDynamoDBAttributeValue
字典。以下参考可能有助于了解如何格式化BatchGetItem
请求。