简体   繁体   中英

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. I got parse push notifications working on iOS (and Android) using a development provisioning profile. 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:

  • Checked to make sure the parse module was set up in config.json with the right keys
  • Check to make sure I'm using the new correct provisioning profile to build the app
  • Used the correct .p12 file for the parse certificate.
  • Made sure I'm subscribed to the correct channel.

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.

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. 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. The correct module for this is called forge.partners.parse .

You can trigger push notifications manually from the Parse Web Interface. 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. 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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM