Search code examples
c#iosapple-push-notificationssspimoonapns

Push notification not appearing


I can't seem to get MoonAPNS to work. I know there have been a few questions on the same issue, for example this one. I've followed the tutorial on creating the p12 certificate and successfully used it with a php script to send a notification to the device but I can't figure out how to use it with MoonAPNS. I'va also installed the certificate in Windows. The debug seems to suggest that a notification is being sent but nothing shows up on the iPad.

Here's my code:

[WebMethod]
public void PushNotificationAlert()
{
    var payload1 = new NotificationPayload("874b30056afc0ab4fc01ea1e3b51e8dc6ee7b1ea2e75083a17dec8e929a08112", "Message", 1, "default");
    payload1.AddCustom("RegionID", "IDQ10150");
    var p = new List<NotificationPayload> { payload1 };
    var push = new PushNotification(false, "C:\\myKey.p12", "password");
    var rejected = push.SendToApple(p);
    foreach (var item in rejected)
    {
        Console.WriteLine(item);
    }
    Console.ReadLine();
}   

Solution

  • Turns out I only had to change the false to true and the notification arrived.