If you want to change the icon of the icon, use the following code.
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo { application.applicationIconBadgeNumber = 0; NSLog(@"userInfo %@",userInfo); for (id key in userInfo) { NSLog(@"key: %@, value: %@", key, [userInfo objectForKey:key]); } [application setApplicationIconBadgeNumber:[[[userInfo objectForKey:@"aps"] objectForKey:@"badge"] intValue]]; NSLog(@"Badge %d",[[[userInfo objectForKey:@"aps"] objectForKey:@"badge"] intValue]); }
We also need to modify the php file. So we can automatically change the icon icon
// Create the payload body $body['aps'] = array( 'alert' => $message, 'sound' => 'default', 'id' => '135', 'badge' => 8 );
Anit kumar
source share