【发布时间】:2017-12-19 01:17:34
【问题描述】:
我可以在 AWS dynamoDB 中的单个表上执行简单的 Get 请求,但是当我将其扩展为跨多个表的批处理请求时,我继续收到错误
validation error detected: Value null at 'requestItems.rip.member.keys' failed to satisfy constraint
我理解这是因为值没有正确传递,但我看不出我的代码有什么问题
//Create Request Values
AWSDynamoDBGetItemInput *getItem = [AWSDynamoDBGetItemInput new];
AWSDynamoDBAttributeValue *hashValue = [AWSDynamoDBAttributeValue new];
hashValue.S = @"User Test";
getItem.key = @{@"ripId": hashValue};
//Create Request Values 2
AWSDynamoDBGetItemInput *getItem2 = [AWSDynamoDBGetItemInput new];
AWSDynamoDBAttributeValue *hashValue2 = [AWSDynamoDBAttributeValue new];
hashValue2.S = @"User Test";
getItem2.key = @{@"chat": hashValue2};
//Combine to Batch Request
AWSDynamoDBBatchGetItemInput * batchFetch = [AWSDynamoDBBatchGetItemInput new];
batchFetch.requestItems = @{ @"rip": getItem,
@"chat": getItem,};
[[dynamoDB batchGetItem:batchFetch] continueWithBlock:^id(BFTask *task) {
if (!task.error) {
NSLog(@"BOY SUCCES");
} else {
NSLog(@" NO BOY SUCCESS %@",task.error);
}
return nil;
}];
在互联网上到处搜索,但看不到使用 iOS Objective C(或 swift)的批处理请求的工作示例。
我在一个 Get 请求中测试了这两个变量,它们都可以工作。
【问题讨论】:
-
从我读到的这批获取项目不能与 AWSDynamoDBObjectMapper 一起使用?有没有办法对此表示哀悼,或者是否必须手动迭代并从原始数据创建对象?
标签: ios objective-c amazon-web-services amazon-dynamodb