【问题标题】:Parse.com Cloud Code FailingParse.com 云代码失败
【发布时间】:2015-02-20 20:18:10
【问题描述】:

我正在尝试使用以下云代码

Parse.Cloud.job("sendAlert", function(sendAlert, status) { Parse.Push.send({ data: { "content-available": 1, } }, { success: function() { status.success("Push Worked!!!"); }, error: function(error) { status.error("Uh oh, something went wrong."); } }); });

发送silent 推送警报。

它失败并调用错误函数。有什么问题?

【问题讨论】:

  • 传递给错误函数的参数可能会提供线索。
  • 它显示的错误是什么?您还可以查看错误日志以获取更多信息。
  • @Fogmeister The log: E2015-02-20T20:22:29.903Z] v21: Ran job sendAlert with: Input: {} Failed with: Uh oh, something wrong.
  • 是的。那是你自己的信息。你已经把那个文本放在那里了。尝试改用status.error(error);。这就是错误的原因。
  • @Fogmeister 新日志 - pastebin.com/WNkeZj0c。谢谢。

标签: parse-platform push-notification push


【解决方案1】:

请允许我回答我自己的问题,我得到了以下代码。

var query = new Parse.Query(Parse.Installation);

Parse.Cloud.job("sendAlert", function(sendAlert, status) {
Parse.Push.send({
    where: query, // Set our Installation query
    data: {
        alert: "Broadcast to everyone"
    }
}, {
success: function() {
    status.success("Push Worked!!!");
 },
error: function(error) {
    status.error("Uh oh, something went wrong.")
}
});
});

【讨论】:

    猜你喜欢
    • 2015-08-08
    • 2016-05-04
    • 2014-08-31
    • 2014-11-23
    • 2016-02-08
    • 2016-02-24
    • 2013-06-23
    • 2015-04-14
    • 1970-01-01
    相关资源
    最近更新 更多