I know that this question is tipical but I'm missing something and I don't kwon what is.
I have a simple application, in iOS 7. Using Xcode 6. I'm developing in objective-c.
I want to receive push notifications and update my app icon badge to (1) but I can't trigger the didReceiveRemoteNotification method when the app is in background so I can't set the badge number. This is not my first app with push notifications and badges but I can't do it...
My code:
- (void)application:(UIApplication*)application didReceiveRemoteNotification:(NSDictionary*)userInfo
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:1];
NSLog(@"RECEIVING NOTIFICATION");
When i'm on the app the badge is correctly setted and the log is printed, but if I'm in background mode the method is not triggered.
My payload APNS
{"aps":{"alert":"New push","sound":"default"}}
I want to set the badge manualy to 1. I don't need it on de payload.
Any suggestions? Thanks