0

I want to change badge of my application when my application is in inactive state. When my application is in active state The badge is incrementing by 1 by

-(void)application:(UIApplication *)application didReceiveRemoteNotification:    (NSDictionary *)userInfo 
{    
    NSInteger badgeNumber = [application applicationIconBadgeNumber];

    [application setApplicationIconBadgeNumber:++badgeNumber];   
    NSInteger badgeNumber = [application applicationIconBadgeNumber];

    [application setApplicationIconBadgeNumber:++badgeNumber];
}

But when my application is in the inactive state. I read that the operating system automatically give the badge send in the payload. Here is my payload:

{
    "aps": {
        "alert": "You have an image to view",
        "sound": "default",
        "badge": 2
    }
}

But the badge is not changing. Can any one help me with this.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
user1878531
  • 55
  • 1
  • 9
  • so you receive the alert notification but the badge doesn't change? ...your code is right. Other info that you can give us? – Matteo Gobbi May 26 '14 at 10:22
  • As far I know it is the operating system who changes the badge automatically.But it is not changing.I tried on different divices but it didn't work. – user1878531 May 26 '14 at 10:30

0 Answers0