如何取消或停止来自客户端的推送通知?
我有一个向客户端发送推送通知的Web服务器.客户端可以在iOS 10上使用UNNotificationServiceExtension
拦截推送通知并更改内容.现在,我想取消在某些通知上在客户端显示的推送通知.我怎么做?我试图做
I have a webserver that sent a client a push notification. The client can intercept the push notification with UNNotificationServiceExtension
on iOS 10 and change the content. Now I want to cancel a push notification from showing on client side on certain notifications. How do I do that? I tried to do
self.contentHandler(nil);
但是没有用.怎么做?
似乎不可能,但不确定.从文档中:
It look like it might not be possible, but not sure. From the docs:
您可以修改原始请求中的任何内容.你可能会 为当前用户自定义内容或将其全部替换. 您可以使用此方法下载图像或电影并将其添加为 内容的附件.您还可以修改警报文本,只要 因为您不删除它. 如果内容对象不包含任何内容 警报文本,系统将忽略您的修改并提供 原始通知内容.
You can modify any of the content from the original request. You might customize the content for the current user or replace it altogether. You can use this method to download images or movies and add them as attachments to the content. You may also modify the alert text as long as you do not remove it. If the content object does not contain any alert text, the system ignores your modifications and delivers the original notification content.
以nil调用该块只会显示原始通知吗?
Calling the block with nil just displays the original notification?