Repository navigation
fix(ios): Adopt the UIKit scene life cycle (6.8) - #25688
agneszitte merged 9 commits into
Conversation
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-25688/docs/index.html |
|
The build 241261 did not find any UI Test snapshots differences. |
19e65f3 to
2479841
Compare
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-25688/docs/index.html |
|
The build 241266 did not find any UI Test snapshots differences. |
|
|
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-25688/docs/index.html |
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-25688/docs/index.html |
|
The build 241386 did not find any UI Test snapshots differences. |
|
|
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-25688/docs/index.html |
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
|
The build 241692 did not find any UI Test snapshots differences. |
|
|
a65fd95 to
09c3000
Compare
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-25688/docs/index.html |
|
The build 242366 did not find any UI Test snapshots differences. |
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-25688/docs/index.html |
|
The build 244964 did not find any UI Test snapshots differences. |
85e1428 to
f492645
Compare
|
This pull request is merged. |
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-25688/docs/index.html |
|
The build 246811 did not find any UI Test snapshots differences. |
f492645 to
e5879c8
Compare
|
The build 246965 did not find any UI Test snapshots differences. |
agneszitte
left a comment
There was a problem hiding this comment.
Thanks, all 5 points are addressed. CI is green on the rebased branch: the scene test passes on iOS Skia, and the 19 new unit tests pass. Approving.
GitHub Issue: closes #25510
PR Type:
🐞 Bugfix
What changed? 🚀
Apps built with the version 27 SDKs (Xcode 27) must use the UIKit scene lifecycle, or iOS 27 refuses to launch them:
UIScene life cycle is required for apps built with this SDK. Uno 6.8 only runs the app lifecycle, so every 6.8 app built with Xcode 27 crashes at launch. Thanks to @mikernet for the report and the proposal this follows.This PR makes 6.8 adopt the scene lifecycle on the app's behalf, for both Skia and native rendering, with no scene manifest needed:
UnoUseSceneLifecycleInfo.plist key overrides the default in either direction.GetConfiguration(see the end of this description).UIApplicationSceneManifestkeeps it. Uno only assigns its scene delegate to an application scene configuration that declares no delegate class.GetConfiguration, which is what makes UIKit switch to the scene lifecycle, and assigns the new internalUnoUISceneDelegateto the application scene. It hides that selector when the app stays on the app lifecycle.Application) and Skia (UnoUIApplicationDelegate) delegates.UnoAdoptedSceneDelegate, the same name as the master fix (fix(ios): Adopt the scene lifecycle without a manifest #25687), so an app updated from 6.8 to 7.0 gets its saved scene session restored with the right delegate.UnoUseSceneLifecycleis neither a boolean nor a number, or the SDK version is unknown.OpenUrl,ContinueUserActivity,PerformActionForShortcutItem,OnActivatedandDidEnterBackgroundkeep working. A failing callback is logged with its name and raised as an unhandled exception, and a shortcut's completion handler runs once.Application.PerformActionForShortcutItemnow calls its completion handler. It never did, under either lifecycle, so with native rendering a forwarded shortcut was never completed. The docs now say that an override callingbasemust not call the handler again. The Skia application delegate still doesn't implement shortcuts, as before.FinishedLaunching, for both renderers. Under the scene lifecycle, UIKit delivers the URL, user activity or shortcut the app was launched with once the scene connects.OnLaunched, thenOnActivatedwith aPreviousExecutionStateofRunning, instead ofOnActivatedalone.OnLaunched, then one carrying the shortcut's arguments.SupportedOSPlatformVersionand the workload requires a higher minimum, the Uno.Sdk now uses the workload's minimum and says so in the build output. A version the app sets is kept.Given_Window.When_Scene_Lifecycle_Window_Hosted_In_Application_Scene. It's inconclusive under the app lifecycle. It fails if its reflection lookup ofUsesSceneLifecyclefinds nothing, for instance once trimmed, instead of carrying on as if the app used the scene lifecycle.UnoUseSceneLifecycle, so the new test runs under the scene lifecycle in CI. CI builds with Xcode 26.1.1, where the default is the app lifecycle, and runs no native iOS tests. CI therefore no longer covers the default app lifecycle path. The native SamplesApp keeps the default for its SDK.AppleUIKitLifecycleDecision.Decide(hasSceneManifest, useSceneLifecycle, sdkVersion), the same shape as on master. New unit testsGiven_AppleUIKitLifecycleDecisionrun master's cases plus SDK 26 and 26.1: a scene manifest, the key set totrue,falseor unset, and 26.x, 27+, unreadable or missing SDK versions.customizing-uiapplicationdelegate.md: new Scene life cycle section, including the remaining differences and the startup log.using-the-uno-sdk.md: the minimum OS version rule, and a Mac Catalyst row in the defaults table.The master counterpart is #25687, which fixes the same crash for apps without a scene manifest on top of master's scene support.
Validation
All runtime checks ran on simulators with Xcode 27.1.
After the review fixes (this branch rebased on
servicing/6.808e60ff):Given_AppleUIKitLifecycleDecision, 19 cases, pass. Changing>= 27to> 27made the 27 cases fail.Given_Windowhas no failures, and the scene test passes instead of going inconclusive. The startup log readsRunning the scene life cycle (scene manifest: False, UnoUseSceneLifecycle: true, SDK version: 27.1).false: the app lifecycle runs, and the scene test fails on the Skia iOS assertion.Uno.UI,Uno,Uno.Foundation,Uno.UI.CompositionandUno.UI.Dispatching), built for the simulator in Release withRegistrar=managed-static, which iOS 27.1 device builds use. On iOS 27 it renders its page, and its scene's delegate isUnoAdoptedSceneDelegate, hosting the key window. The app was started withUIApplication.Main(args, null, typeof(App))rather than the host builder, for a reason unrelated to this PR.Uno.UIbuilds in Release with analyzers on, fornet9.0-iosandnet10.0-ios. The Skia SamplesApp builds too. The native SamplesApp doesn't build onservicing/6.8itself (CS0260 and CS0234 inUno.UI.RuntimeTests), with or without this PR.Compile:
net9.0-ios) and the nativeUno.UI(net10.0-ios) build.Runtime, the current code:
Given_Windowhas no failures, the new test included.UnoUseSceneLifecycle=false: the app lifecycle path.Given_Windowhas no failures and the new test is inconclusive.OnSuspending, thenOnResuming.UnoUseSceneLifecyclelogs its warning.Uno.UI.dll, it launches throughOnLaunchedand renders.Runtime, the earlier test plan (run before the native launch was changed to start immediately):
trueand with it removed. Withfalse, iOS refuses to launch the app, as UIKit requires.Not validated yet
servicing/6.8runs no native iOS tests. The unit tests and local runs cover it.PR Checklist ✅
Screenshots Compare Test Runresults.No API changes; the new Info.plist key is the one addition. Apart from the
GetConfigurationcase below, the behavior only changes for apps built with a version 27 SDK, which couldn't launch before. For those, the launch URL, shortcut or user activity is no longer inFinishedLaunching's launch options and arrives after the launch, and the obsoleteOpenUrl(app, url, sourceApp, annotation)overload isn't called. Both are documented.One behavior change also reaches apps built with an older SDK. An application delegate that overrides
GetConfiguration, without a scene manifest, used to switch UIKit to the scene lifecycle. Uno now hides that method while the app stays on the app lifecycle, so such an app runs the app lifecycle unless it setsUnoUseSceneLifecycletotrue. The docs say so.