简体   繁体   English

在iOS Swift 4中重置FCM徽章计数

[英]Reset FCM badge count in iOS Swift 4

How do I reset the FCM badge count in iOS swift 4? 如何在iOS Swift 4中重置FCM徽章计数? Right now I call this line of code: 现在,我将这行代码称为:

UIApplication.shared.applicationIconBadgeNumber = 0

which temporarily sets the badge count to 0, but when I receive a new notification the count starts back at the previous count. 这会暂时将标志计数设置为0,但是当我收到新通知时,计数将从上一个计数重新开始。

IE 100, open the app and reset the count to 0 as above. IE 100,打开应用程序并将计数重置为0,如上所述。 Then when I get a new notification the badge goes to 101. 然后,当我收到新通知时,徽章将转到101。

Is there something different I need to do for FCM? 我需要为FCM做些其他的事情吗? I have ensured that the server is sending the correct badge count. 我已确保服务器发送正确的徽章计数。

I ended up finding the issue to be a syntax error when clearing the notification count server side. 我最终在清除通知计数服务器端时发现此问题是语法错误。 Thanks for your suggestions. 感谢您的建议。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM