简体   繁体   English

iPhone-推送通知已从通知中心删除

[英]iPhone - Push notifications removed from notification center

In the iOS app I am developing, when a push notification is sent, a popup appears, but if the user doesn't tap on it the notification is lost and it is not even in the missed notifications center. 在我正在开发的iOS应用中,当发送推送通知时,会出现一个弹出窗口,但是如果用户不点击它,则通知会丢失,甚至不在错过的通知中心。

How can I solve this? 我该如何解决?

just add these line in your code. 只需在代码中添加这些行即可。 set the setApplicationIconBadgeNumber=0 设置setApplicationIconBadgeNumber = 0

   int badgeCount = [UIApplication sharedApplication].applicationIconBadgeNumber;
    [[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];
    [[UIApplication sharedApplication] cancelAllLocalNotifications];
    [[UIApplication sharedApplication] setApplicationIconBadgeNumber:badgeCount];

refer this for ore info Remove single remote notification from Notification Center 请参阅此以获取矿石信息从通知中心删除单个远程通知

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

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