不要收到Push Notification iPhone

时间:2014-01-17 13:29:18

标签: c# apple-push-notifications pushsharp moonapns

我使用两个simle示例在iPhone上发送推送通知。

第一个例子。我使用PushSharp发送:

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"));

第二个例子。我使用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);

有人可以解释一下为什么它不起作用吗?

0 个答案:

没有答案