Changing icon on iOS10.3 with push notifications

iOS 10.3 brings the ability to change iOS app icon. Let's combine this with push notifications!

Looks like magic? Let's implement this!

XCode setup

First of all you need to add new icon images to your project and to Info.plist file.

Locate "CFBundleIcons" (a.k.a. "Icon files (iOS 5)) in your Info.plist file and add "CFBundleAlternateIcons" property there. See the full set-up on the screenshot below.

Let's add some code to push notifications handler onPushReceived function to change the app's icon. In this example we will use "changeIcon" custom data parameter to set the icon:

    func onPushReceived(_ pushManager: PushNotificationManager!, withNotification pushNotification: [AnyHashable : Any]!, onStart: Bool) {
        let userData = PushNotificationManager.push().getCustomPushData(asNSDict: userInfo)
        let icon = userData?["changeIcon"]
        if var icon: String = icon as? String {
            if icon == "nil" {
                icon = ""
            DispatchQueue.main.async {
                UIApplication.shared.setAlternateIconName(icon, completionHandler: { (error) in

				//the rest of the code
- (void)onPushReceived:(PushNotificationManager *)pushManager withNotification:(NSDictionary *)pushNotification onStart:(BOOL)onStart {
    NSDictionary *data = [[PushNotificationManager pushManager] getCustomPushDataAsNSDict:pushNotification];
    NSString * icon = [data objectForKey:@"changeIcon"];
    if (icon != nil) {
        if ([icon isEqualToString:@"nil"])
            icon = nil;
        NSLog(@"icon is: %@", icon);
        dispatch_async(dispatch_get_main_queue(), ^{
            [[UIApplication sharedApplication] setAlternateIconName:icon completionHandler:^(NSError * _Nullable error) {
                NSLog(@"Set icon error = %@", error.localizedDescription);

  //the rest of the code

Sending a push to trigger icon change

Now go to the control panel and let's test this! Set the push title:

Set the custom data. In this case I'll use "xmas_sale" as icon (see Info.plist setup):


Changing icon on iOS10.3 with push notifications