iOS Push Notifications Setting the application icon badge number

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

Use the following piece of code to set the badge number from within your application (suppose someNumber has been declared before):

Objective-C

[UIApplication sharedApplication].applicationIconBadgeNumber = someNumber;

Swift

UIApplication.shared.applicationIconBadgeNumber = someNumber

In order to remove the badge completely, just set someNumber = 0.



Got any iOS Question?