ios - 递增解析对象中的字段。结果 : TypeError: Object [object Object] has no method 'Increment'

标签 ios parse-platform parse-cloud-code

在 Parse 的“afterSave”方法中,我想增加 Parse 对象中的一个字段。我通过以下方式获取对象并递增:

Parse.Cloud.afterSave("Activity", function(request) {

if(request.object.get("type") == "joinedGame") {
   var aGameObject = request.object.get("toGameR");
   var gameRQuery = new Parse.Query("GameR");
   gameRQuery.get(aGameObject, {
         success: function (obj) {
              obj.Increment("numberOfPlayers");
              obj.save();
            },
            error: function(error) {
                   console.log("Failed: " +error.message);
            }
     });
  }

此代码会在“afterSave”函数被调用且第一个“if”语句成立时递增“numberOfPlayers”字段的次数。 “obj”也被保存。递增的“numberOfPlayers”字段显示在 Parse DB 中。但是,解析日志显示以下错误:

结果:TypeError:Object [object Object] has no method 'Increment'

最佳答案

很确定它是 increment 而不是 Increment

这是一个 Parse 执行 something similar 的示例.

关于ios - 递增解析对象中的字段。结果 : TypeError: Object [object Object] has no method 'Increment' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29854919/

相关文章:

ios - NSURL 始终为空

ios - 有谁知道 Parse.com 文档发生了什么事?

ios - TableView 不显示来自 parse.com 的数据

ios - 解析云代码返回114函数未找到

node.js - Swift 错误读取 Cloud Code 错误

ios - Parse.com 自定义单元格 boolean 值

ios - 在 swift-ObjC 中访问扩展中的静态变量

ios - 在 Swift 3 中使用变量进行类型转换

ios - Parse.com - 将指针从用户类设置为安装类

ios - 无法将多个参数从 iOS 发送到 Cloud Code