Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Black screen on launch when migrating to SwiftUI application flow

Tags:

ios

swift

swiftui

I have done all of the refactoring to migrate from SceneDelegate to using a SwiftUI App and Scene with WindowGroup. I noticed that when the app is updated from the previous version, the app launches to a black screen, and you can't do anything with it. No matter how many times you quit and relaunch the app, nothing is navigable. I can log something in the init function of the App struct, but not in the onAppear modifier.

Uninstalling the app and installing it fresh works fine, but I don't want users to have to do this (I verified that this issue also happens when updating from my released app to a TestFlight beta).

like image 333
Benjamin Kindle Avatar asked Oct 12 '25 04:10

Benjamin Kindle


1 Answers

The best way to get around this seems to be to leave the info.plist configuration that tells it to look for the SceneDelegate class (UISceneDelegateClassName), but delete the scene delegate. This will cause warnings in the console on launch, but the black screen issue will stop happening.

like image 168
Benjamin Kindle Avatar answered Oct 14 '25 17:10

Benjamin Kindle