如何清除应用程序中的远程通知? [英] How to clear the remote notification in your app?
本文介绍了如何清除应用程序中的远程通知?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
从iPhone屏幕顶部向下滑动时,是否有办法从通知横幅中清除远程通知.我尝试将徽章编号设置为零:
Is there a way to clear the remote notification from the notification banner when swiping down from the top of the iPhone screen. I tried setting the badge number to zero:
application.applicationIconBadgeNumber = 0
委托didFinishLaunchingWithOptions
和didReceiveRemoteNotification
中的
,但没有清除通知.谢谢.
in delegate didFinishLaunchingWithOptions
, and didReceiveRemoteNotification
, but it did not clear the notifications. Thanks.
推荐答案
您需要将IconBadgeNumber设置为0并取消当前通知.我从来没有迅速做过,但是我认为它的代码会像下面这样:
You need to set the IconBadgeNumber to 0 and cancel the current notifications. I never did in swift but I think the code for it would be as bellow:
application.applicationIconBadgeNumber = 0
application.cancelAllLocalNotifications()
这篇关于如何清除应用程序中的远程通知?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文