iOS localized icons: defer setAlternateIconName: to active state (#4870 follow-up)#4873
Open
shai-almog wants to merge 1 commit intomasterfrom
Open
iOS localized icons: defer setAlternateIconName: to active state (#4870 follow-up)#4873shai-almog wants to merge 1 commit intomasterfrom
shai-almog wants to merge 1 commit intomasterfrom
Conversation
…surface errors (#4870 follow-up) Builds on #4870 (CFBundleIconName injection) which made actool emit the correct partial Info.plist. Even with a correctly merged CFBundleIcons.CFBundleAlternateIcons table, calling -[UIApplication setAlternateIconName:completionHandler:] from application:didFinishLaunchingWithOptions: still fails silently with NSCocoaErrorDomain Code=3072 ("operation was cancelled") because no foreground UIScene is yet available to anchor the system icon-change alert. Without a completion handler the failure was silent, which is why developers reported "no localized icon and no permission dialog" even after #4870. Changes in buildLocalizedIconSelectorObjC(): * Defer the icon switch to the next UIApplicationDidBecomeActiveNotification (or run immediately on the main queue if the app is already active), giving iOS an active scene to host the system alert. * Pass a real completion handler that NSLogs successes and errors so any remaining bundle-configuration problem is visible in the device log instead of being swallowed. Validated end-to-end against a freshly generated cn1app-archetype project: actool produces the expected CFBundleAlternateIcons entry, the resulting .app builds for the iOS 18.6 and iOS 26.3 simulators, and LaunchServices logs "Setting preferredIconName to AppIcon_es" on launch under es_ES locale, where the prior selector logged NSUserCancelledError. The matching change is in the BuildDaemon repo. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
✅ Continuous Quality ReportTest & Coverage
Static Analysis
Generated automatically by the PR CI workflow. |
Collaborator
Author
Collaborator
Author
|
Compared 90 screenshots: 90 matched. Native Android coverage
✅ Native Android screenshot tests passed. Native Android coverage
Benchmark ResultsDetailed Performance Metrics
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Follow-up to #4870 — that PR injected
CFBundleIconNameso actool emits the partialInfo.plistwithCFBundleAlternateIcons. The bundle config is now correct, but developers still reported "no localized icon and no permission dialog." Reason: the runtime selector calls-[UIApplication setAlternateIconName:completionHandler:]fromapplication:didFinishLaunchingWithOptions:, where iOS cancels the call (NSCocoaErrorDomaincode 3072) because no foregroundUISceneis up yet to anchor the system alert. The previouscompletionHandler:nilswallowed the error.This PR changes
buildLocalizedIconSelectorObjC()inIPhoneBuilderso the runtime selector:UIApplicationDidBecomeActiveNotification(or runs immediately on the main queue if the app is already active);NSLogs successes and errors so any remaining bundle-configuration problem is visible in the device log.The matching BuildDaemon change is on its own branch (rebased onto current master after #70 was merged); a separate PR will land it there.
Test plan
mvn install -pl codenameone-maven-plugin -Plocal-dev-javase).cn1app-archetypeproject (mvn package … -Dcodename1.buildTarget=ios-source) emits:Images.xcassets/AppIcon_es.appiconset/with 60@2x, 60@3x, 76@2xipad, 83.5@2xipad PNGs and a matchingContents.json;<key>CFBundleIconName</key><string>AppIcon</string>in the sourceInfo.plist;ASSETCATALOG_COMPILER_ALTERNATE_APPICON_NAMES = "AppIcon_es"inproject.pbxproj;cn1ApplyIconblock +UIApplicationDidBecomeActiveNotificationobserver at all three marker positions inCodenameOne_GLAppDelegate.m.xcodebuildforiphonesimulatorsucceeds.Info.plistin the built.appcontainsCFBundleAlternateIcons.AppIcon_es.es_ESlocale: noNSErrorlogged; LaunchServices logsSetting preferredIconName to AppIcon_es for { bundleID: com.example, ... }. With the prior dispatch_async-only attempt the same setup loggedNSUserCancelledError— confirming the active-state observer is the variable that fixes it.🤖 Generated with Claude Code