0

I have a peculiar station in one of my apps. Alt ought I call:

[UIApplication sharedApplication].applicationIconBadgeNumber=<value>

the badge keeps on not being shown. In the didFinishLaunchingWithOptions of the app delegate I have regularly called:

UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeAlert  |   UIUserNotificationTypeBadge | UIUserNotificationTypeSound) categories:nil];
[application registerUserNotificationSettings:settings];
[application registerForRemoteNotifications];

I also tried to set it by means of a notification, yet the notification is shown but the badge is not updated. What might be the issue or how could I know better?

Bhavin Ramani
  • 3,221
  • 5
  • 30
  • 41
Fabrizio Bartolomucci
  • 4,948
  • 8
  • 43
  • 75

2 Answers2

0

First of all register UIUserNotificationSettings

UIUserNotificationSettings* notificationSettings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert | UIUserNotificationTypeBadge categories:nil];

[[UIApplication sharedApplication] registerUserNotificationSettings:notificationSettings];

[UIApplication sharedApplication].applicationIconBadgeNumber = <value>;
Moin Shirazi
  • 4,372
  • 2
  • 26
  • 38
  • As you see in my code snippet, that is what I did upfront, much before the badge is updated. – Fabrizio Bartolomucci Apr 04 '16 at 10:50
  • Sorry i didn't saw that... But i think you can get help from this answer http://stackoverflow.com/questions/11317701/apple-push-notification-not-changing-icon-badge-automatically – Moin Shirazi Apr 04 '16 at 10:54
0

It was much much easier. Apparently iOS upon an update removed the "show badge icon" from the app settings. Once enabled the badge updates correctly. Thanks for your support anyway.

Fabrizio Bartolomucci
  • 4,948
  • 8
  • 43
  • 75