简体   繁体   中英

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.

How can I solve this?

just add these line in your code. set the 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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