且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

解析推送通知云代码错误?

更新时间:2023-02-26 21:17:49

可以请尝试以下代码:

var query = new Parse.Query(Parse.Installation);
// query condition (where equal to .. etc.)

var payload = {
    alert: "New Event Added",
    sound: "default" 
};





Parse.Push.send({
    where: query, // Set our Installation query
    data: payload
}, {
        success: function () {

        },
        error: function (error) {
            // Handle error
        }
    });

请注意,我要删除 useMasterKey ,如果要添加useMasterKey,则需要将其插入到闭包中,但对我来说,它不需要useMasterKey即可

Please notice that i remove the useMasterKey if you want to add useMasterKey you need to insert it inside closures but for me it's works without the useMasterKey

useMasterKeyVersion应该如下所示:

the useMasterKeyVersion should look like the following:

Parse.Push.send({
    where: query, // Set our Installation query
    data: payload
},
{
   useMasterKey: true
},
{
    success: function () {

    },
    error: function (error) {
        // Handle error
    }
});

promise版本(根据***实践):

The promises version (according to best practices):

Parse.Push.send({where: query,data: payload})
.then(function(){
    // success
},function(error){
    // error .. 
});

更新

通过查看index.js文件,您似乎没有将facebook oauth添加到您的三方身份验证登录名中. 因此您需要添加以下内容:

by looking at your index.js file it looks like you didn't add the facebook oauth to your 3-party authentication logins. so you will need to add the following:

oauth: {
   facebook: {
     appIds: "FACEBOOK APP ID"
   }
}

在您的 emailAdapter 配置下方,并在"FACEBOOK APP ID"中放入您在Facebook开发人员中创建的应用ID

below your emailAdapter config and inside "FACEBOOK APP ID" put the app ID that you created in facebook developers