Note that there are some explanatory texts on larger screens.

plurals
  1. POSome Apple Push Notifications from Azure Mobile Services not Arriving
    text
    copied!<p>I've been struggling with this for a few days and am stuck. I am using Azure Mobile Services and have two scheduler scripts defined. One is very simple and just sends all device tokens for User ID #1 a test push notification:</p> <pre><code>function SendTestNotification() { sendPushNotification(1, 'SendTestNotification @ ' + new Date()); function sendPushNotification(userId, body) { var users = tables.getTable('NotificationTokens'); users.where({ User_Id: userId }).read({ success: function(tokens) { tokens.forEach(function(token) { var alert = { badge: 0, alert: body, sound: 'default' }; push.apns.send(token.Token, alert, { error : function(err) { console.error(err); } }); }); }, error: function(error) { console.error(error) return; } }); } } </code></pre> <p>I have a second scheduler script which is much more elaborate and contains the actual push notification logic for my app. It contains the exact same sendPushNotification() function shown above. This 2nd script also contains an additional call to send me a "test" notification.</p> <p>So all told, with these two scripts setup and scheduled, my iOS devices should get a total of 3 push notifications every 15 minutes. I have them timestamped as well so that they show when the notification was sent from the server.</p> <p>However, when I run these scripts either manually or just let them run on their own every 15 minutes, I almost never get all of the notifications. Sometimes I get none. Sometimes I only get the first test notification. Sometimes I get the first test notification, the "real" notification, but not the 2nd test notification (which should have been sent by the exact same code that sent the "real" notification).</p> <p>I have checked the logs on the portal and there are no errors coming back from APNS. I know the logging is working as I've seen errors for invalid device tokens in the past.</p> <p>I should also state that I've sent these devices push notifications via APNS using a simple C# application with absolutely no problem.</p> <p>Can anyone give any suggestions or see what I may be doing wrong? I have an app waiting to be reviewed and would love to get this issue taken care of.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload