嘿,我使用Parse作为我的后端,我喜欢它,但我有afterSave钩子的问题。解析云代码afterSave不工作
这里是我使用的代码:
Parse.Cloud.afterSave ("JGZwoelf",function (request) {
Parse.Push.send({
//Selecting the Channel
channels: [ request.object.get('JGZwoelfPush') ],
data: {
//Selecting the Key inside the Class
alert: request.object.get('AusfallInfo')
}
}, {
success: function() {
//Push was send successfully
},
error: function (error) {
//Handle error
throw "Got an error" + error.code + " : " + error.message;
}
});
});
每次登录控制台告诉我:结果:
未捕获得到了一个error112:缺少通道名称。
我只是不明白什么是错的!它必须在该JavaScript代码中。如果我进入推送通知手动一切正常:/
编辑: 的部分Parse.Push.send应该是这样的:
Parse.Push.send ({
//Selecting the already existing Push Channel
channels: ["JGAchtPush"], //This has to be the name of your push channel!!
data: {
//Selecting the Key inside the Class
alert: request.object.get ("AusfallInfo")
}
}, {
success: function() {
//Push was sent successfully
//nothing was loged
},
error: function (error) {
throw "Got and error" + error.code + " : " + error.message;
}
});
通道名称必须是这样的[“exampleChannel” ]。
预先感谢任何帮助:)