嘿,我使用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」 ]。
預先感謝任何幫助:)