I use this encoding to notify Apple push, push notifications come, but they come without any badges, any suggestions what is wrong with this code that I do not receive badges. I already check the settings tab and the icons are displayed there.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [[UIApplication sharedApplication] registerForRemoteNotificationTypes: (UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)]; [UIApplication sharedApplication].applicationIconBadgeNumber = 0; } - (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken1 { NSString *str = [NSString stringWithFormat:@"%@",deviceToken1]; NSLog(@"%@",str); self.deviceToken = [NSString stringWithFormat:@"%@",str]; NSLog(@"dev --- %@",self.deviceToken); self.deviceToken = [self.deviceToken stringByReplacingOccurrencesOfString:@"<" withString:@""]; self.deviceToken = [self.deviceToken stringByReplacingOccurrencesOfString:@" " withString:@""]; self.deviceToken = [self.deviceToken stringByReplacingOccurrencesOfString:@">" withString:@""]; NSLog(@"dev --- %@",self.deviceToken); } - (void)application:(UIApplication *)app didFailToRegisterForRemoteNotificationsWithError:(NSError *)err { NSString *str = [NSString stringWithFormat: @"Error: %@", err]; NSLog(@"%@",str); } - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo { NSLog(@"Received notification: %@", userInfo);
source share