#24812·uno

[iOS] Launch scene is destroyed when the initial Window is created after an await in OnLaunched

Author: MartinZikmundCreated Sep 29, 2026Updated Sep 29, 2026
Labelskind/bugplatform/ios 🍎area/skia ✏️

Current behavior

Found by code review; not reproduced on a device yet.

Under the scene lifecycle (an app with UIApplicationSceneManifest), the launch scene is destroyed if the initial Window doesn't exist yet when UIKit calls scene:willConnectToSession:options:.

Binding only works one way, with the window waiting for the scene:

  • NativeWindowFactoryExtension.CreateWindow registers the window wrapper in SceneWindowRegistry.
  • UnoUISceneDelegate.WillConnect calls SceneWindowRegistry.TryTake(...). If nothing is registered, it calls RequestSceneSessionDestruction and returns.

This only works today because Application.Start calls OnLaunched synchronously on iOS. So an app that creates its window after an await loses its launch scene:

csharp
protected override async void OnLaunched(LaunchActivatedEventArgs args)
{
    await InitializeAsync();      // UIKit connects the launch scene here -> nothing registered -> destroyed
    MainWindow = new Window();
    MainWindow.Activate();
}

Related cases that come from the same one-way binding:

  • The launch scene never carries the window's GUID, so it is always matched through the "oldest pending window" fallback. A restored or OS-created scene can take a secondary window that is still waiting for its own requested scene.
  • Scenes the app didn't request (iPad "New Window" in the app switcher, drag to split view, sessions restored beyond the initial window) are always discarded instead of reaching the app as an activation.

Expected behavior

A launch scene that connects before the initial Window is created should be held until that window exists, then bound to it. The app should show its UI no matter how OnLaunched is written.

How to reproduce it (as minimally and precisely as possible)

  1. Create an Uno app with an iOS head that opts into the scene lifecycle: a UIApplicationSceneManifest in Info.plist plus a UnoUISceneDelegate subclass (see SamplesApp Platforms/iOS/SceneDelegate.iOS.cs).
  2. In OnLaunched, await Task.Delay(100); before new Window().
  3. Run on the iPad simulator.
  4. Expected: the app's UI. Suspected actual: the log shows No window is awaiting a scene ... discarding the session, and no UI appears.

Workaround ️

Create the initial Window synchronously at the start of OnLaunched, before any await.

Renderer

  • Skia
  • Native

Affected platforms ️

iOS

Uno.Sdk version (and other relevant versions)

master (after #19082)

IDE version ‍

N/A

Anything else we need to know?

The proposed redesign that fixes this is in the linked enhancement issue. Related: #19082, #8341.