[英]Trigger.io & Parse push notifications don't work when I switch to production certificate
Using Trigger.io and Parse - I'm trying to submit my app to the iOS store. 使用Trigger.io和Parse-我正尝试将我的应用提交到iOS商店。 I got parse push notifications working on iOS (and Android) using a development provisioning profile. 我使用开发配置文件解析了可在iOS(和Android)上使用的推送通知。 I switched to an ad-hoc production certificate, and now the same code gets this error: 我切换到临时生产证书,现在相同的代码得到此错误:
TypeError: 'undefined' is not an object
For this line: (In reality it's more complex but I stripped it down to this line and it still doesn't work.) 对于此行:( 实际上,它更复杂,但我将其简化为该行,但仍然无法使用。)
forge.event.messagePushed.addListener(function (msg) {
forge.logging.log(JSON.stringify(msg));
});
Things I've done: 我所做的事情:
What am I doing wrong? 我究竟做错了什么?
edit: Cleaned up code for more clarity. 编辑:清理代码以更清楚。
edit: Check out the comments for more info. 编辑:查看注释以获取更多信息。 It might help to mention that when I run 我跑步时可能要提一下
forge.event.messagePushed.addListener(function (msg) {
alert(JSON.stringify(msg));
});
It returns an alert (with message: "undefined") right away. 它立即返回警报(带有消息:“ undefined”)。
In your question you are actually talking about two different things. 在您的问题中,您实际上是在谈论两种不同的事物。
The forge.notification
module has nothing to do with the push notifications provided by the Parse integration. forge.notification
模块与Parse集成提供的推送通知无关。 The former can be used to send a notification to the user's phone which is triggered by the app and while the app is opened . 前者可用于将通知发送到用户的手机,该通知由该应用触发并在该应用打开时触发。
In my opinion this is not extremely useful to send push notifications, as those are usually triggered when something happens while the user is not currently using the app . 我认为这对于发送推送通知不是非常有用,因为通常在用户当前不使用该应用程序时发生某些事件时触发该推送通知。 Thats where the Parse integration comes into play. 那就是Parse集成发挥作用的地方。 The correct module for this is called forge.partners.parse
. 正确的模块称为forge.partners.parse
。
You can trigger push notifications manually from the Parse Web Interface. 您可以从解析Web界面手动触发推送通知。 Go to the Push section of your app (URL: https://parse.com/apps/<your app>/push_notifications
) and choose + Send a push
on the top. 转到应用程序的“推送”部分(URL: https://parse.com/apps/<your app>/push_notifications
: https://parse.com/apps/<your app>/push_notifications
<您的应用https://parse.com/apps/<your app>/push_notifications
),然后在顶部选择+ Send a push
。 There you can target, customize and send your push. 您可以在那里定位,自定义和发送推送。 Hope this helps. 希望这可以帮助。
If you want to automatically trigger push notifications based on certain events (eg on your backend server), you should have a look at the Parse Push Notification Guide . 如果您想基于某些事件自动触发推送通知(例如,在后端服务器上),则应查看《 解析推送通知指南》 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.