Parse.com Failed with: ReferenceError

后端 未结 1 621
情书的邮戳
情书的邮戳 2021-01-29 02:42

I am trying to run the following parse background job in Cloud Code

   Parse.Cloud.job(\"sendAlert\", function(sendAlert) {
     Parse.Push.send({
       data:          


        
相关标签:
1条回答
  • 2021-01-29 03:11

    If you look for the word status in your code, you will see that you haven't declared it anywhere. A variable named status can't just come out of nowhere, so that's why you're getting a ReferenceError.

    According to the documentation, the second parameter passed into the Parse.Cloud.job() callback is a JobStatus object with error and success methods, so it seems that's what you're trying to use:

    //                       declare it here   ---------v
    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.");
            }
        });
    });
    
    0 讨论(0)
提交回复
热议问题