Skip to content

Fix unit test host crash on iOS 27 by adopting the UIScene life cycle - #25930

Merged
crazytonyli merged 2 commits into
trunkfrom
bugfix/ios27-test-host-uiscene-lifecycle
Aug 24, 2026
Merged

Fix unit test host crash on iOS 27 by adopting the UIScene life cycle#25930
crazytonyli merged 2 commits into
trunkfrom
bugfix/ios27-test-host-uiscene-lifecycle

Conversation

@crazytonyli

Copy link
Copy Markdown
Contributor

iOS 27 removed the legacy window life cycle, so the unit test host's plain UIWindow() crashed at launch with "UIScene life cycle is required for apps built with this SDK" before the test runner could connect. This blocked every app-hosted (WordPressTest) suite on iOS 27 while the same binary ran on iOS 26.5.

TestingAppDelegate now opts into the scene life cycle the same way WordPressAppDelegate does, vending a minimal TestingSceneDelegate that builds the host window in scene(_:willConnectTo:). The window shows a SwiftUI "Running unit tests" placeholder. Verified the previously crashing suites pass on both iOS 27 and iOS 26.5.

iOS 27 removed the legacy window life cycle, so the unit test host's plain
UIWindow() crashed at launch with "UIScene life cycle is required for apps
built with this SDK" before the test runner could connect. This blocked every
app-hosted (WordPressTest) suite on iOS 27 while the same binary ran on iOS
26.5.

TestingAppDelegate now opts into the scene life cycle the same way
WordPressAppDelegate does, vending a minimal TestingSceneDelegate that builds
the host window in scene(_:willConnectTo:). The window shows a SwiftUI
"Running unit tests" placeholder. Verified the previously crashing suites pass
on both iOS 27 and iOS 26.5.
@crazytonyli crazytonyli added this to the 27.3 milestone Aug 23, 2026
@crazytonyli
crazytonyli requested a review from jkmassel August 23, 2026 06:27
@crazytonyli crazytonyli added the Tooling Build, Release, and Validation Tools label Aug 23, 2026
@wpmobilebot

wpmobilebot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor
App Icon📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress
ConfigurationRelease-Alpha
Build Number33922
VersionPR #25930
Bundle IDorg.wordpress.alpha
Commitff879ae
Installation URL4rg81t3krg58g
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot

wpmobilebot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor
App Icon📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack
ConfigurationRelease-Alpha
Build Number33922
VersionPR #25930
Bundle IDcom.jetpack.alpha
Commitff879ae
Installation URL5e9vkbk1e9v50
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@crazytonyli
crazytonyli enabled auto-merge August 23, 2026 08:14

@jkmassel jkmassel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

// The delegate-window fallback covers the moments when no scene key window
// exists: early in scene connection (before makeKeyAndVisible) and in the unit
// test host, which never connects a window scene.
connectedScenes
.compactMap { ($0 as? UIWindowScene)?.keyWindow }
.first
?? (delegate?.window).flatMap { $0 }
mentions "never connects a window scene", which IINM this PR makes incorrect.

@crazytonyli
crazytonyli added this pull request to the merge queue Aug 24, 2026
@jkmassel
jkmassel removed this pull request from the merge queue due to a manual request Aug 24, 2026
The unit test host adopted the UIScene life cycle, so the delegate-window
fallback no longer covers it. Drop the stale claim that the test host never
connects a window scene.
@crazytonyli
crazytonyli enabled auto-merge August 24, 2026 21:55
@crazytonyli

Copy link
Copy Markdown
Contributor Author

@jkmassel Good catch! Updated in the latest commit.

@crazytonyli
crazytonyli added this pull request to the merge queue Aug 24, 2026
Merged via the queue into trunk with commit e5a5abf Aug 24, 2026
28 checks passed
@crazytonyli
crazytonyli deleted the bugfix/ios27-test-host-uiscene-lifecycle branch August 24, 2026 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Tooling Build, Release, and Validation Tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants