Swift-删除推送通知徽章号码?

时间:2022-08-26 21:31:33

I am trying to remove the icon badge in swift, but PFInstallation doesn't seem to work anymore. How do I do this?

我正在尝试删除图标徽章在斯威夫特,但PFInstallation似乎不再工作。我该怎么做呢?

1 个解决方案

#1


140  

You can "remove" the app badge icon by setting it to 0:

你可以将app badge图标设置为0,“移除”:

Swift < 3.0

斯威夫特< 3.0

UIApplication.sharedApplication().applicationIconBadgeNumber = 0

Swift 3.0+

斯威夫特3.0 +

UIApplication.shared.applicationIconBadgeNumber = 0

This question shows when you can use it: How to clear push notification badge count in iOS?

这个问题表明你何时可以使用它:如何在iOS中清除推送通知标记计数?

#1


140  

You can "remove" the app badge icon by setting it to 0:

你可以将app badge图标设置为0,“移除”:

Swift < 3.0

斯威夫特< 3.0

UIApplication.sharedApplication().applicationIconBadgeNumber = 0

Swift 3.0+

斯威夫特3.0 +

UIApplication.shared.applicationIconBadgeNumber = 0

This question shows when you can use it: How to clear push notification badge count in iOS?

这个问题表明你何时可以使用它:如何在iOS中清除推送通知标记计数?