最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

iOS 18 Not Updating App Icon in Notifications After Changing Alternate Icon - Stack Overflow

programmeradmin2浏览0评论

I am trying to change my app icon dynamically using setAlternateIconName in iOS. The icon change works as expected, but I have noticed a difference in behaviour between iOS 15 and iOS 18.

On iOS 15 : When I change the app icon, the new icon is correctly reflected in system notifications. On iOS 18 : The app icon changes successfully, but notifications still display the old icon instead of the updated one.

Here is the code I am using to change the icon:

- (void)changeIconToClub {
    if ([[UIApplication sharedApplication] supportsAlternateIcons]) {
        [[UIApplication sharedApplication] setAlternateIconName:@"AppIcon_ClubIcon" completionHandler:^(NSError * _Nullable error) {
            if (error) {
                NSLog(@"Failed to change icon: %@", error.localizedDescription);
            } 
        }];
    } else {
        NSLog(@"Alternate icons are not supported on this device.");
    }
}

Additional Setup : I have added the required alternate icons in the AppIcon section of Assets.xcassets. In Build Settings, I have set: INCLUDE_ALL_APPICON_ASSETS = YES ALTERNATE_APPICON_NAMES = AppIcon_ClubIcon

Expected Behavior: After changing the app icon, I expect notifications to reflect the new icon on all iOS versions.

Actual Behavior: The icon updates correctly in the app. On iOS 15, notifications display the updated icon. On iOS 18, notifications continue showing the old icon.

Question: Is there a known issue with setAlternateIconName in iOS 18 where notifications do not update to the new icon? If so, is there a workaround to force the updated icon in notifications?

Any insights or solutions would be greatly appreciated!

发布评论

评论列表(0)

  1. 暂无评论