gpt4 book ai didi

ios - Dynamo DB iOS dynamoDBObjectMapper存储双倍

转载 作者:行者123 更新时间:2023-12-01 16:35:22 24 4
gpt4 key购买 nike

在dynamo db中管理double类型的值的正确方法是什么?我可以使用[dynamoDBObjectMapper save:]向数据库中成功添加一个double,但是当我尝试使用[dynamoDBObjectMapper query:[DynamoTransaction class] expression:queryExpression]获得它时,它给了我以下异常:

NSInvalidArgumentExeption
setObjectForKey: object cannot be nil (key: amount)

我从数据库获取对象的代码如下:
-(void)loadTransactionsFromDatabase:(NSString*)userID successBlock:(void(^)(NSArray*))successBlock{
[self connectToInternetWithsuccessBlock:^{

AWSDynamoDBObjectMapper *dynamoDBObjectMapper = [AWSDynamoDBObjectMapper defaultDynamoDBObjectMapper];
AWSDynamoDBQueryExpression *queryExpression = [AWSDynamoDBQueryExpression new];
queryExpression.hashKeyValues = userID;
queryExpression.scanIndexForward = @YES;

[[[dynamoDBObjectMapper query:[DynamoTransaction class] expression:queryExpression]continueWithExecutor:[BFExecutor mainThreadExecutor] withSuccessBlock:^id(BFTask*task){

NSMutableArray*transactionsArray = [[NSMutableArray alloc]init];
AWSDynamoDBPaginatedOutput*paginatedOutput = task.result;
for(DynamoTransaction*databaseTransaction in paginatedOutput.items){
Transaction*transaction = [[Transaction alloc]initWithDynamoTransaction:databaseTransaction];
[transactionsArray addObject:transaction];
}

if(successBlock!=nil){successBlock(transactionsArray);}
NSLog(@"loaded all my transactions from database");
return nil;

}]continueWithBlock:^id(BFTask*task){
NSLog(@"Failed");
return nil;
}];
} andFailBlock:^{
NSLog(@"loadTransactions Problem");
}];
}

当我在数据库中有一个非十进制数字时,它始终有效

我该怎么办?
非常感谢你

最佳答案

就我而言,我解决了更新我的Pod的问题(AWSiOSSDKv2 2.0.17(原为2.0.13))。

请参阅:AWS IOS SDK DynamoDB Scan - MainThread works in emulador, but don't in device debugger

关于ios - Dynamo DB iOS dynamoDBObjectMapper存储双倍,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28801964/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com