1

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?

user3370459
  • 126
  • 4
  • It is removed when you call to [[UIApplication sharedApplication] setApplicationIconBadgeNumber:0]; or any similar code – Rajesh Sep 02 '14 at 07:21

1 Answers1

0

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

Community
  • 1
  • 1
Sport
  • 8,570
  • 6
  • 46
  • 65
  • 1
    I want it to be cleared only when the app is launched, and be kept in the notification center until the user taps it or launch the app. What happens now is when the user misses it, it gets removed from the notification center – user3370459 Sep 02 '14 at 07:39