Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

applicationIconBadgeNumber is not updated

Hi,

In my app, I use Local Notifications to inform the user about the app needing his attention - with two buttons, Close and YES.

If YES is tapped, the app takes the action. If Close it tapped, the applicationIconBadgeNumber is shown on the icon for the app. This part works fine. However, if the user taps Close several time, the badge number in my case is not updated - it shows 1 all the time.

In the Reference Class and the discussions on the net, I understand that there is nothing that the developer has to do to update the badge number - the O/S is supposed to do that.

Am I missing something?

Regards.

iMac, Mac OS X (10.5.5)

Posted on Apr 3, 2011 11:06 AM

Reply
6 replies

Apr 3, 2011 12:37 PM in response to K T

What I am saying is that if I add the NSLogs to the delegate methods, they are not going to be fired until the user taps YES button. Am I right in saying that?

These are the scenarios:

* app is not running: the notification is presented, icon shows badge number. When YES is tapped, application:didFinishLaunchingWithOptions: method is called

* app is running in foreground: application:didReceiveRemoteNotification: method is called

* app is running in background: <not sure of what happens> - my understanding is that the action is same as in case of "app is not running", except that applicationDidBecomeActive: method is called


I can see that when NSLog statements can be helpful when the app is running (in foreground and background) because the debugger is still attached to the process.

How do I see the output of NSLog statements when the app is not running at all and the debugger is not attached to any process?

Apr 3, 2011 1:07 PM in response to Shnaps

What I am saying is that until you evidence actual events, we don't know. I'm trying to get you to move away from assumptions and deal with reality 🙂

I don't enjoy wasting time debating what should be occurring. I'd rather confirm first, then determine if anything is actionable.

Apr 3, 2011 1:35 PM in response to K T

Hi KT,

Please don't get me wrong. I am confused and frustrated with this simple thing. I am not trying to argue with anyone - just trying to understand stuff...

Having said that.... here is what I have:


App in Background + YES on Notification:
----------------------------------------
application:didFinishLaunchingWithOptions: method is not called.
applicationWillEnterForeground: method is called.
<SamAppDelegate.m:97> -[SamAppDelegate applicationWillEnterForeground:], (applicationWillEnterForeground)
<SamAppDelegate.m:129> -[SamAppDelegate application:didReceiveLocalNotification:], didReceiveLocalNotification::::::: Scheduled Notifications are: (
"<UIConcreteLocalNotification: 0x5792a80>{fire date = 2011-04-03 07:00:00 +0000, time zone = (null), repeat interval = 64, next fire date = 2011-04-03 20:03:00 +0000}"
)
<SamAppDelegate.m:137> -[SamAppDelegate application:didReceiveLocalNotification:], (didReceiveLocalNotification) notification.applicationIconBadgeNumber=1
<SamAppDelegate.m:138> -[SamAppDelegate application:didReceiveLocalNotification:], (didReceiveLocalNotification) application.applicationIconBadgeNumber=1
<SamAppDelegate.m:108> -[SamAppDelegate applicationDidBecomeActive:], (applicationDidBecomeActive) applicationIconBadgeNumber=0





App in Foreground + YES on Notification:
----------------------------------------
applicationWillEnterForeground: method is called and then
didReceiveLocalNotification: method is called
<SamAppDelegate.m:129> -[SamAppDelegate application:didReceiveLocalNotification:], didReceiveLocalNotification::::::: Scheduled Notifications are: (
"<UIConcreteLocalNotification: 0x5781360>{fire date = 2011-04-03 07:00:00 +0000, time zone = (null), repeat interval = 64, next fire date = 2011-04-03 20:04:00 +0000}"
)
<SamAppDelegate.m:137> -[SamAppDelegate application:didReceiveLocalNotification:], (didReceiveLocalNotification) notification.applicationIconBadgeNumber=1
<SamAppDelegate.m:138> -[SamAppDelegate application:didReceiveLocalNotification:], (didReceiveLocalNotification) application.applicationIconBadgeNumber=0

applicationIconBadgeNumber is not updated

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.