C# PushSharp-如何触发OnDeviceSubscriptionExpired
我有如下的标准pushsharp代码C# PushSharp-如何触发OnDeviceSubscriptionExpired,c#,ios,push-notification,pushsharp,C#,Ios,Push Notification,Pushsharp,我有如下的标准pushsharp代码 PushBroker push = new PushBroker(); var appleCert = File.ReadAllBytes(@"myp12.p12"); push.OnNotificationSent += NotificationSent; push.OnChannelException += ChannelException; push.OnServiceException += ServiceExcepti
PushBroker push = new PushBroker();
var appleCert = File.ReadAllBytes(@"myp12.p12");
push.OnNotificationSent += NotificationSent;
push.OnChannelException += ChannelException;
push.OnServiceException += ServiceException;
push.OnNotificationFailed += NotificationFailed;
push.OnDeviceSubscriptionExpired += DeviceSubscriptionExpired;
push.OnChannelCreated += ChannelCreated;
push.OnChannelDestroyed += ChannelDestroyed;
push.RegisterAppleService(new ApplePushChannelSettings(false, appleCert, "password"));
push.QueueNotification(new AppleNotification()
.ForDeviceToken(mydevice)
.WithAlert("hello world")
.WithBadge(1)
.WithSound("default")
.WithCategory("INVITE_CATEGORY")
.WithCustomItem("custom-item", "i'm so cool"));
push.StopAllServices();
我可以发送推送通知。在正确的时间调用适当的事件
我想测试的是,当苹果告诉我这个特定的订阅已经过期时,会发生什么逻辑。我附加了这个事件,但我似乎无法让它被调用。看起来差不多是这样
static void DeviceSubscriptionExpired(object sender, string expiredDeviceSubscriptionId, DateTime timestamp, INotification notification)
{
//logic that deactivates subscription in database
}
如何触发此事件
我想我可以删除该应用程序,然后尝试向该设备发送多个通知。但这似乎不起作用
我错过了什么?我认为iOS不支持此活动。在我与PushSharp合作的两年中,苹果公司返回的唯一事件是ServiceException。但我从谷歌收到了DeviceSubscriptionExpired和DeviceSubscriptionChanged。正确,当前无法使用APNS使用此事件。在PushSharp 3.x中完成HTTP/2 APNS提供程序API实现后,它将可用。