For some reason, my app has icon badge of 7 but I have not coded this part of the code and can't seem to get rid of this number. How can I get rid of it or where can I manipulate with this object?
-
without implementing badge, it is impossible to have!!! Check if it is really a badge or just an app's image? – Anoop Vaidya Apr 09 '14 at 06:44
-
it's definitely not the app image. I still don't know where the 7 is coming from. I got rid of it with Z S's answer below but then I think this will always set the badge icon to 0. – user3513175 Apr 09 '14 at 16:40
-
You can probably disable the badge update types with `-enabledRemoteNotificationTypes` on `UIApplication` – Aaron Apr 09 '14 at 18:19
-
@user3513175 Are you sure that whatever is setting the badge number isn't happening seven times? You may be accidentally sending duplicate notifications, etc. – Nerrolken Jul 29 '15 at 17:42
3 Answers
Look for applicationIconBadgeNumber
in your code. To reset it to zero, use
[UIApplication sharedApplication].applicationIconBadgeNumber = 0
(you can set this in your App Delegate's application: willFinishLaunchingWithOptions: method
)
-
This clears the badge icon no problem. However, once I receive a new push notification, the badge icon displays as 7 again. – user3513175 Apr 09 '14 at 16:42
If you are pushing notifications, you set that in your payload. Look for a badge property in your json payload and remove it. Make sure you also remove that alert type (Badge) from your notification types to register for.

- 38
- 1
- 4
You can, in UIApplication
set the enabled remote notification types to only sounds and alerts, omitting the badge type:
- (UIRemoteNotificationType)enabledRemoteNotificationTypes {
return UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert;
}
From the docs, it looks like the user has the ability to change this from the Settings app:
The values in the returned bit mask indicate the types of notifications currently enabled for the app. These types are first set when the app calls the
registerForRemoteNotificationTypes:
method to register itself with Apple Push Notification Service. Thereafter, the user may modify these accepted notification types in the Notifications preference of the Settings app. This method returns those initial or modified values. iOS does not display or play notification types specified in the notification payload that are not one of the enabled types. For example, the app might accept icon-badging as a form of notification, but might reject sounds and alert messages, even if they are specified in the notification payload.

- 7,055
- 2
- 38
- 53
-
I've implemented your code in my app delegate.m file. However, my badge still appears. – user3513175 Apr 09 '14 at 18:50