【发布时间】:2016-03-09 19:51:03
【问题描述】:
我正在开发一个使用 raix:push 包来维护推送通知的 Meteor+Cordova 应用程序。我有一个非常简单的配置,它只针对 APNS 和开发模式,看起来像这样:
{
"apn-dev": {
"passphrase": "qwe[]\\qwe[]\\",
"key": "PushChatKey.pem",
"cert": "PushChatCert.pem"
},
"apn": {},
"gcm": {},
"production": false,
"badge": true,
"sound": true,
"alert": true,
"vibrate": true
}
它是指正确放置在 private/ 文件夹中的文件 PushChatKey.pem 和 PushChatCert.pem。密码正确。
我使用一个简单的服务器端发送推送通知:
Meteor.methods({
sendPushNotification: function ({userId = this.userId, title = 'Hello', text = 'and welcome!'} = {}) {
Push.send({
title,
text,
from: 'push',
badge: 14,
query: {
userId
}
});
}
});
问题是,即使证书很好并且配置正确,方法调用
Meteor.call('sendPushNotification', {}, (error, response) => console.log(error, response))
什么都不做。它返回undefined,并且error 和response 都是未定义的(如预期的那样)。甚至对 notification 集合进行了一些简短的操作,我相信在发送了适当的推送通知之后,一个项目出现然后消失。
问题是,移动设备上的应用实例永远不会收到任何这些通知。这可能是有原因的。在服务器端的日志中,有消息
Settings userId "J5baP7xvbuTTX4KTk" for app: mytSJW2xrbKWRuGBZ
Send message "Hello" via query {}
Sent message "Hello" to 0 ios apps 0 android apps
所以我的问题是,我做错了什么?我是否在配置或服务器端或客户端代码中遗漏了某些内容(我没有任何后者可以引用推送通知)?有没有人遇到同样的路障?解决方案是什么?
【问题讨论】:
标签: cordova meteor apple-push-notifications meteor-cordova