0

我使用两个简单的示例在 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);

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

4

0 回答 0