Thank you for the quick answers! But even with the tiniest app and the right clear colors I can see a black flash. And worse, it appears that if the app is loaded ‘cold’ iOS does a ‘nice’ crossfade between launch screen and app, resulting in a slightly longer black screen. Not sure if that is what happens, but that is what it appears like.
So after some digging and talking to chatGPT about possible fixes I ended on the following solution: in the didFinishLaunchingWithOptions method in AppDelegate, load the launch screen storyboard and put it front like so:
// Load the LaunchScreen storyboard
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"LaunchScreen" bundle:nil];
UIViewController *launchScreenVC = [storyboard instantiateInitialViewController];
UIView *launchScreenView = launchScreenVC.view;
// Add the launch screen view as a placeholder
launchScreenView.frame = self.window.bounds;
launchScreenView.tag = 999; // Set a tag to identify the view later
[self.window addSubview:launchScreenView];
[self.window bringSubviewToFront:launchScreenView];
[self.window makeKeyAndVisible];
Then remove this UIView in the appUpdate method
// Cleanup the placeholder view once the engine is initialized
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
dispatch_async(dispatch_get_main_queue(), ^{
UIWindow *window = [UIApplication sharedApplication].keyWindow;
UIView *viewToRemove = [window viewWithTag:999];
[viewToRemove removeFromSuperview];
});
});
Currently I have this working through a native extension by using method swizzling and it looks much smoother. I could make the changes to the engine myself and put in a pull request, however I don’t know how to access the Launch Screen setting in the editor so that it correctly loads the launch screen set by the user.