Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/104.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# PushSharp-如何触发OnDeviceSubscriptionExpired_C#_Ios_Push Notification_Pushsharp - Fatal编程技术网

C# PushSharp-如何触发OnDeviceSubscriptionExpired

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

我有如下的标准pushsharp代码

  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实现后,它将可用。