javascript - Error: TypeError: Object has no method 'set' -
i using cloud code function ios app. calling cloud function code...
var moment = require("moment"); parse.cloud.define("registeractivity", function(request, response) { var user = request.user; user.set("lastactive", new date()); user.save().then(function (user) { response.success(); }, function (error) { console.log(error); response.error(error); }); });
and ios call this...
[pfcloud callfunction:@"registeractivity" withparameters:@{}];
why error?
error: typeerror: object has no method 'set'
you can't pass parse objects through cloud functions , expect them remain parse objects. better solution pass object id, create pointer user object, , set id it. update , save:
var moment = require("moment"); parse.cloud.define("registeractivity", function(request, response) { var user = new parse.user() user.id = request.userid; user.set("lastactive", new date()); user.save().then(function (user) { response.success(); }, function (error) { console.log(error); response.error(error); }); });
Comments
Post a Comment