简体   繁体   中英

Push Notification Not Arriving from Parse Cloud Code

I wrote a simple job to try sending a push notification to myself. Here's the code:

Parse.Cloud.job("testPush", function(request, status) {
    Parse.Cloud.useMasterKey();
    var installationQuery = new Parse.Query(Parse.Installation);
    installationQuery.equalTo("user", "6t1JIuNqe1");  // I triple checked - this is the value of my user in the installation table.
    Parse.Push.send({
        where: installationQuery,
        data: {
            alert: "Test"
        },
    }, {
        success: function() {
            console.log("The Push Test Worked!");
            status.success("All done with the push test!");
        }, error: function(error) {
            console.error("Something bad happened " + error);
            status.error("Something bad happened during the Parse test...");
        }
    });
});

Although it logs in Parse that the job was run successfully, I never see a notification appear on my iPhone. I checked in Settings - it's all set up properly there (notifications are allowed to appear and should appear as banners, they should show up in notification center, they should show up on my lock screen). And yet the notification never appears.

What more do I need to check? What am I missing?

Pointer field should work with an instance.

Try replacing installationQuery.equalTo("user", "6t1JIuNqe1"); with the following:

var user = new Parse.User();
user.id = '6t1JIuNqe1';    
installationQuery.equalTo('user', user);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM