anshul king
anshul king

Reputation: 568

Clearing badge Icon without clearing notifications

I have to clear application badge icon while opening the application. I do clear by setting applicationBadgeIcon to 0.

=> But it clears my all notifications from notification center. I have also tried by setting applicationBadgeIcon to -1, But it also did not work for me.

Is ther Any solution?

Upvotes: 0

Views: 737

Answers (2)

Chirag Shah
Chirag Shah

Reputation: 3016

The thing you need to achieve will not possible if you pass the badge in payload of the push notification. If you any how achieve this behaviour then do one thing remove badge number from payload then you did not bother about to clear badge count and your push still display in notification

disadvantage:

1) user need to remove all notification one by one same like instagram

Otherwise there is no way to achieve this.

Upvotes: 0

Kathiresan Murugan
Kathiresan Murugan

Reputation: 2962

UIApplication.shared.applicationIconBadgeNumber = 0 // Badge count was removed.

Its working fine for me in Swift 4

Upvotes: 0

Related Questions