black screen after switching to UIKit app lifecycle

I had to switch from the SwiftUI app lifecycle to the UIKit lifecycle due to this issue: https://developer.apple.com/forums/thread/742580

When I switch to UIKit I get a black screen on startup. It's the inverse of this issue: https://openradar.appspot.com/FB9692750

For development, I can work around this by deleting and reinstalling the app, but I can't ship an app that results in a black screen for users when they update.

Anyone know of a work-around?

I've filed FB13462315

I would recommend creating a new sample project using UIKit and seeing what parts are different from your app vs. the sample project. Some things that come to mind:

  • Do you have a LaunchScreen storyboard? Is that storyboard file configured correctly in the Info.plist?
  • Do you have a scene manifest section properly defined in your Info.plist? If you are using storyboards, is the initial storyboard properly configured?
  • Does your app have an initial window (either the window automatically created from your storyboard, or the window that should be created manually in your AppDelegate? Is this window being retained anywhere? You can try checking in the view debugger or LLDB whether or not your app has a window.

The reason for this is that FrontBoardServices attempts to use the existing UISceneSession after the update, with the SwiftUI.AppSceneDelegate class, instead of calling application(configurationForConnecting:options:). Since SwiftUI.AppSceneDelegate still exists in the scope, the internal property _configurationNeedsReevaluation on UISceneSession returns true and the app attempts to launch from SwiftUI.AppSceneDelegate.

As far as I can tell, there doesn't seem to be a way to fix this that doesn't involve invoking the private method -[UISceneSession _updateConfiguration:] to force the configuration to use the correct Scene delegate.

Could someone from Apple maybe advise?

black screen after switching to UIKit app lifecycle
 
 
Q