From 5e13e4b6e60bb51fdd007e8b9b1815c931032452 Mon Sep 17 00:00:00 2001 From: Shai Almog <67850168+shai-almog@users.noreply.github.com> Date: Tue, 5 May 2026 13:17:03 +0300 Subject: [PATCH] Fix iOS localized icons: inject CFBundleIconName so actool emits CFBundleAlternateIcons The asset-catalog-based approach for localized iOS launcher icons relies on actool generating a partial Info.plist that contains CFBundleIcons / CFBundleAlternateIcons, which is then merged into the app's Info.plist. actool only emits that partial plist when CFBundleIconName is present in the source Info.plist; without it the alternate icons get compiled into the .car file but the bundle never advertises them, so -[UIApplication setAlternateIconName:completionHandler:] fails at runtime ("alternate icon name not found in bundle"). Inject `CFBundleIconNameAppIcon` whenever localized icons are present so actool produces the correct merged plist and the runtime selector wired up in CodenameOne_GLAppDelegate.m can resolve the locale-specific icon. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../main/java/com/codename1/builders/IPhoneBuilder.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/maven/codenameone-maven-plugin/src/main/java/com/codename1/builders/IPhoneBuilder.java b/maven/codenameone-maven-plugin/src/main/java/com/codename1/builders/IPhoneBuilder.java index 73c8796a38..188bd09878 100644 --- a/maven/codenameone-maven-plugin/src/main/java/com/codename1/builders/IPhoneBuilder.java +++ b/maven/codenameone-maven-plugin/src/main/java/com/codename1/builders/IPhoneBuilder.java @@ -2807,7 +2807,14 @@ public boolean accept(File file, String string) { // resulting partial Info.plist already contains the correct // CFBundleIcons entries, so we deliberately do not inject any // CFBundleAlternateIcons fragment here. Doing so would conflict with - // actool's output during the Info.plist merge. + // actool's output during the Info.plist merge. We do, however, need + // to inject CFBundleIconName -- without it actool will not emit the + // partial Info.plist containing CFBundleIcons / CFBundleAlternateIcons, + // and -[UIApplication setAlternateIconName:] would then fail at runtime + // because the bundle does not advertise the alternate icons. + if (!localizedIcons.isEmpty() && !inject.contains("CFBundleIconName")) { + inject += "\nCFBundleIconName\nAppIcon"; + } String locationUsageDescription = null; if (xcodeVersion >= 9) { if ( (locationUsageDescription = request.getArg("ios.locationUsageDescription", null)) != null ){