每当我使用以下云代码在Parse Server 2.2.24上发送推送通知时
Parse.Push.send({
where: query,
data: {
alert: "You have a new comment on " + rift.get("title")
}
}, { useMasterKey: true }).then(() => {
console.log('Push ok');
}, (e) => {
console.log('Push error', e);
});
我在heroku上设置verbose = 1时得到以下日志。
2016-11-06T05:08:06.783331+00:00 app[web.1]: verbose: RESPONSE from [POST] /api/1/push: {
2016-11-06T05:08:06.783333+00:00 app[web.1]: "headers": {
2016-11-06T05:08:06.783334+00:00 app[web.1]: "X-Parse-Push-Status-Id": "NbZCxyCOgc"
2016-11-06T05:08:06.783334+00:00 app[web.1]: },
2016-11-06T05:08:06.783335+00:00 app[web.1]: "response": {
2016-11-06T05:08:06.783336+00:00 app[web.1]: "result": true
2016-11-06T05:08:06.783336+00:00 app[web.1]: }
2016-11-06T05:08:06.783337+00:00 app[web.1]: } X-Parse-Push-Status-Id=NbZCxyCOgc, result=true
2016-11-06T05:08:06.787076+00:00 app[web.1]: Push ok
2016-11-06T05:08:06.788233+00:00 app[web.1]: verbose: sending push to 1 installations
2016-11-06T05:08:06.789569+00:00 app[web.1]: verb parse-server-push-adapter APNS APNS Connection 0 Notification transmitted to 443d4d770217648350c5c7cd7bb22d2da77223e23c06f3eb016b2e2ca76d6202
2016-11-06T05:08:06.790600+00:00 app[web.1]: verbose: sent push! 1 success, 0 failures
2016-11-06T05:08:06.867209+00:00 app[web.1]: ERR! parse-server-push-adapter APNS cannot find vaild connection for 443d4d770217648350c5c7cd7bb22d2da77223e23c06f3eb016b2e2ca76d6202
2016-11-06T05:08:06.868965+00:00 app[web.1]: verb parse-server-push-adapter APNS APNS Connection 0 Disconnected
2016-11-06T05:08:06.928135+00:00 app[web.1]: verb parse-server-push-adapter APNS APNS Connection 0 Connected
所以它说它已成功发送(我们收到没有通知设备),我们得到一个ERR! parse-server ....用于在Apple的TestFlight应用程序上分发的应用程序上从有效设备注册的每个设备令牌。我已经阅读了多篇关于修复此问题的方法,并尝试了所有方法,但没有任何效果。如果有人对为什么会发生这种情况有任何见解,请告诉我!我将永远感激
我们的index.js具有以下配置设置...我们已经检查了生产证书,甚至拒绝了我们所有的证书并生成了新的证书。
push: {
ios: {
pfx: 'cert-prod.p12',
bundleId: 'a.bundle.id'
}
}
答案 0 :(得分:0)
我最近遇到过这个问题。您确定pfx文件的路径是完整路径吗?我使用路径模块来解决这个问题:
var path = require('path');
opts.push.ios = {
// The filename of private key and certificate in PFX
pfx: path.join(__dirname, env.IOS_PUSH_PFX),
bundleId: env.IOS_BUNDLE_ID
}
来自https://github.com/ParsePlatform/parse-server/issues/3025#issuecomment-258957541
的参考资料