• <tfoot id='0qvz7'></tfoot>
    <legend id='0qvz7'><style id='0qvz7'><dir id='0qvz7'><q id='0qvz7'></q></dir></style></legend>
    <i id='0qvz7'><tr id='0qvz7'><dt id='0qvz7'><q id='0qvz7'><span id='0qvz7'><b id='0qvz7'><form id='0qvz7'><ins id='0qvz7'></ins><ul id='0qvz7'></ul><sub id='0qvz7'></sub></form><legend id='0qvz7'></legend><bdo id='0qvz7'><pre id='0qvz7'><center id='0qvz7'></center></pre></bdo></b><th id='0qvz7'></th></span></q></dt></tr></i><div id='0qvz7'><tfoot id='0qvz7'></tfoot><dl id='0qvz7'><fieldset id='0qvz7'></fieldset></dl></div>
      <bdo id='0qvz7'></bdo><ul id='0qvz7'></ul>

    1. <small id='0qvz7'></small><noframes id='0qvz7'>

        AWS DynamoDB Objective C 中的递增数字属性

        时间:2023-08-29

          <i id='lYfjW'><tr id='lYfjW'><dt id='lYfjW'><q id='lYfjW'><span id='lYfjW'><b id='lYfjW'><form id='lYfjW'><ins id='lYfjW'></ins><ul id='lYfjW'></ul><sub id='lYfjW'></sub></form><legend id='lYfjW'></legend><bdo id='lYfjW'><pre id='lYfjW'><center id='lYfjW'></center></pre></bdo></b><th id='lYfjW'></th></span></q></dt></tr></i><div id='lYfjW'><tfoot id='lYfjW'></tfoot><dl id='lYfjW'><fieldset id='lYfjW'></fieldset></dl></div>

          <small id='lYfjW'></small><noframes id='lYfjW'>

          • <legend id='lYfjW'><style id='lYfjW'><dir id='lYfjW'><q id='lYfjW'></q></dir></style></legend>
                  <bdo id='lYfjW'></bdo><ul id='lYfjW'></ul>

                    <tbody id='lYfjW'></tbody>
                  <tfoot id='lYfjW'></tfoot>
                • 本文介绍了AWS DynamoDB Objective C 中的递增数字属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在努力增加已保存在我的 DynamoDB 表中的项目的数字属性值,我的代码当前是:

                  I am struggling with incrementing a number property value of an item already saved in my table on DynamoDB my code currently is:

                          AWSDynamoDBUpdateItemInput *updateItemInput = [AWSDynamoDBUpdateItemInput new];
                          updateItemInput.tableName = @"Table";
                  
                          updateItemInput.key= @{
                                                 @"KeyPropertyName":@"KeyValue"
                                                  };
                          updateItemInput.updateExpression = @"SET(counter = counter + :val)";
                          updateItemInput.expressionAttributeValues =@{
                                                                       @":val":@1
                                                                       };
                          AWSDynamoDB *dynamoDB = [AWSDynamoDB defaultDynamoDB];
                  
                          [[dynamoDB updateItem:updateItemInput]
                           continueWithBlock:^id(AWSTask *task) {
                               if (task.error) {
                                   NSLog(@"The request failed. Error: [%@]", task.error);
                               }
                               if (task.exception) {
                                   NSLog(@"The request failed. Exception: [%@]", task.exception);
                               }
                               if (task.result) {
                                   //Do something with result.
                               }
                               return nil;
                           }];
                  

                  当我不注释掉 updateExpression 和 expressionAttributeValues 时,我的应用程序总是崩溃.当我创建我的项目类型的空实例时,我可以到达块,当我创建 AWSDynamoDBAttributeValue 的实例以传递密钥时,我会得到奇怪的结果.有什么建议?我是否也错误地编写了我的 updateExpression?

                  My app always crashes when I do not comment out the updateExpression and expressionAttributeValues. I can reach the block when I create an empty instance of my item type and get strange results when I create an instance of AWSDynamoDBAttributeValue to pass in the key. Any suggestions? Am I also improperly writing my updateExpression?

                  我还将在另一个对象的数组/列表和字典/映射属性中添加更新和删除项目.这会有什么不同?

                  I am also going to be adding updating and deleting items in array/list and dictionary/map properties on another object. How would this differ?

                  推荐答案

                  有几件事.key定义如下:

                  @property (nonatomic, strong) NSDictionary<NSString *, AWSDynamoDBAttributeValue *> * _Nullable key;
                  

                  您需要将 @"KeyValue" 替换为 AWSDynamoDBAttributeValue 的实例.

                  You need to replace @"KeyValue" with an instance of AWSDynamoDBAttributeValue.

                  expressionAttributeValues定义如下:

                  @property (nonatomic, strong) NSDictionary<NSString *, AWSDynamoDBAttributeValue *> * _Nullable expressionAttributeValues;
                  

                  您需要将 @1 替换为 AWSDynamoDBAttributeValue 的实例.

                  You need to replace @1 with an instance of AWSDynamoDBAttributeValue.

                  确保使用最新版本的适用于 iOS 的 AWS 开发工具包,以便您可以在头文件中看到泛型注释.它可以帮助您构建正确的请求对象.

                  Make sure to use the latest version of the AWS SDK for iOS so that you can see the generics annotations in the header file. It helps you construct the proper request object.

                  这篇关于AWS DynamoDB Objective C 中的递增数字属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:AWS DynamoDB 批量获取请求 - iOS 下一篇:基本操作中的 Android Amazon DynamoDb 错误

                  相关文章

                  最新文章

                  • <bdo id='usGrh'></bdo><ul id='usGrh'></ul>

                  <small id='usGrh'></small><noframes id='usGrh'>

                    1. <i id='usGrh'><tr id='usGrh'><dt id='usGrh'><q id='usGrh'><span id='usGrh'><b id='usGrh'><form id='usGrh'><ins id='usGrh'></ins><ul id='usGrh'></ul><sub id='usGrh'></sub></form><legend id='usGrh'></legend><bdo id='usGrh'><pre id='usGrh'><center id='usGrh'></center></pre></bdo></b><th id='usGrh'></th></span></q></dt></tr></i><div id='usGrh'><tfoot id='usGrh'></tfoot><dl id='usGrh'><fieldset id='usGrh'></fieldset></dl></div>

                      <legend id='usGrh'><style id='usGrh'><dir id='usGrh'><q id='usGrh'></q></dir></style></legend>
                    2. <tfoot id='usGrh'></tfoot>