我正在尝试从网络发送推送(Javascript)推送消息已成功添加到quickblox帐户的队列中,状态为已发送,但我没有在设备(iPhone)上接收它。当我从Web控制台发送推送时,我能够成功接收它。请告诉我代码有什么问题或者需要进行任何设置。
发送推送的代码如下:
var params = {
login: .....,
password: .....
}
QB.createSession(params, function(err, result) {
if(!err){
var pushCustomParams = {
message: 'Message sent successfully',
ios_badge: 1,
ios_sound: 'ringtone.wav',
user_id: app.caller.id
}
var params1 = {
notification_type: 'push',
user: {ids: [recp_id]}, // recipients.
environment: 'development', // environment, can be 'production' as well.
message: QB.pushnotifications.base64Encode(JSON.stringify(pushCustomParams)) // See how to form iOS or Android spesific push notifications
};
QB.pushnotifications.events.create(params1, function(err, response) {
if (err) {
console.log(err);
} else {
// success
}
});
}
});
答案 0 :(得分:0)
试试这样:
var params1 = {
notification_type: 'push',
push_type: 'apns', // http://quickblox.com/developers/Messages#Create_event
user: {ids: [recp_id]},
environment: 'development',
message: QB.pushnotifications.base64Encode(JSON.stringify(pushCustomParams))
};
我希望这会有所帮助。