0

I use two simle example for sending push notifications on iPhone.

First example. I use PushSharp for sending:

var push = new PushBroker();
var appleCert = File.ReadAllBytes(@"C:\pushService.p12");
push.RegisterAppleService(new ApplePushChannelSettings(appleCert, "xxxxxxxxxx"));
push.QueueNotification(new AppleNotification()
    .ForDeviceToken("3b04d81f071e4ce729a0490bf9c730a1c10bf723f2308490ffb1a9b2d721975d")
    .WithAlert("Hello World!")
    .WithBadge(7)
    .WithSound("sound.caf"));

Second example. I use MoonAPNS

var payload = new NotificationPayload("3b04d81f071e4ce729a0490bf9c730a1c10bf723f2308490ffb1a9b2d721975d",
                    "Hello world", 0, "sound.caf");
var notificationList = new List<NotificationPayload> {payload};
var pushh = new PushNotification(true, @"C:\pushService.p12", "xxxxxxxxxx");
var result = pushh.SendToApple(notificationList);

Can somebody explain me why it dont work?

Alberto
  • 15,626
  • 9
  • 43
  • 56
Oleh
  • 447
  • 1
  • 11
  • 30
  • In case of `PushSharp`, have you subscribed to the `push.OnServiceException`, `push.OnChannelException` and `push.OnNotificationFailed` events? I would suspects some network problems. Do you have connection to the `gateway.sandbox.push.apple.com` on port `2195`? – Konrad Kokosa Jan 17 '14 at 13:37
  • I insert try chatch. There are no any exceptions. – Oleh Jan 17 '14 at 13:39
  • Try catch is not enough, `QueueNotification` is asynchronous. You will be informed about any errors from events that I've mentioned. – Konrad Kokosa Jan 17 '14 at 13:45
  • Everything is ok. My friend create new certeficate and dont tell me. This code works. – Oleh Jan 20 '14 at 14:58

0 Answers0