ios – DynamoDB:提供的过滤器参数计数不支持尝试的过滤器操作

我正在使用带有Amazon Web Services的iOS SDK

我正在尝试使用以下代码发出扫描请求:

DynamoDBScanRequest *request = [[DynamoDBScanRequest alloc] initWithTableName:self.tableName];
DynamoDBCondition *condition = [[DynamoDBCondition alloc] init];
[condition setComparisonOperator:@"GT"];
NSString *key = [[alertView textFieldAtIndex:0] text];    //Returns NSString @"00610"

[request setScanFilterValue:condition forKey:key];

DynamoDBScanResponse *response = [self.dbClient scan:request];

我收到此错误:

The attempted filter operation is not supported for the provided filter argument count

请有人帮忙解释发生了什么!!!!

最佳答案 条件要求条件名称的特定大小的AttributeValueList基于条件的名称;此错误表示您尝试使用错误数量的attributeValues使用GT(大于).大于需要1个属性值,因此可能提供0或2.

以下是其他条件以及它们所需的属性值数量:

NOT_NULL     0  (exists)
NULL         0  (not exists)
EQ           1  (equal) 
NE           1  (not equal)
IN           1  (exact matches)
LE           1  (less than or equal to)
LT           1  (less than)
GE           1  (greater than or equal to)
GT           1  (greater than)
CONTAINS     1  (substring or value in a set)
NOT_CONTAINS 1  (absence of a substring or absence of a value in a set)
BEGINS_WITH  1  (a substring prefix)
BETWEEN      2  (between)
点赞