Black Screen Between Launch Screen and Game on iOS

I have an iOS app that has a launch image with a purple background. When the app starts the first screen also has a purple background, but there is always a flash (maybe 0.1 second) of a black screen between the two.

This is a minor problem/annoyance but I wondered if anyone else had seen it or found a solution, as it prevents a smooth transition into the app.

I am setting the purple background color in the project.xml. I was originally using launch images, but since switching to a storyboard the issue still persists.

Has anyone else experienced this?

I had a look at a couple of other iOS games that were made with OpenFL and the ‘black flash’ seems to be present too. I also found a similar post to this on the Stencyl forums (based on OpenFL) here: https://community.stencyl.com/index.php/topic,61300.msg316002.html#msg316002

It seems like might be a minor issue with OpenFL and I might just have to live with it?

The simplest workaround would be to use a black screen as the launch image, so I’ll probably do that. But it’s not quite as nice as immdiately showing a launch image then smoothly transitioning to the game.

Here are the related commits from when I attempted to fix this issue in Stencyl.

  1. In SDL, disable the automatic hiding of the launch storyboard.

    This change was never made in a public repository, so I’ve copied the diff here.

    diff --git a/src/video/uikit/SDL_uikitappdelegate.m b/src/video/uikit/SDL_uikitappdelegate.m
    index ac37ebd..373822c 100644
    --- a/src/video/uikit/SDL_uikitappdelegate.m
    +++ b/src/video/uikit/SDL_uikitappdelegate.m
    @@ -351,17 +351,17 @@ SDL_LoadLaunchImageNamed(NSString *name, int screenh)
     {
         /* Hide the launch screen the next time the run loop is run. SDL apps will
          * have a chance to load resources while the launch screen is still up. */
    -    [self performSelector:@selector(hideLaunchScreen) withObject:nil afterDelay:0.0];
    +    //[self performSelector:@selector(hideLaunchScreen) withObject:nil afterDelay:0.0];
     
         /* run the user's application, passing argc and argv */
         SDL_iPhoneSetEventPump(SDL_TRUE);
         exit_status = forward_main(forward_argc, forward_argv);
         SDL_iPhoneSetEventPump(SDL_FALSE);
     
    -    if (launchWindow) {
    -        launchWindow.hidden = YES;
    -        launchWindow = nil;
    -    }
    +    //if (launchWindow) {
    +    //    launchWindow.hidden = YES;
    +    //    launchWindow = nil;
    +    //}
     
         /* exit, passing the return status from the user's application */
         /* We don't actually exit to support applications that do setup in their
    
    
  2. The function that we’ve stopped from running now has to be explicitly called by the game.

    This means we need to expose it through a native binding in an extension.

    [(SDLUIKitDelegate *)[[UIApplication sharedApplication] delegate] hideLaunchScreen];
    

    Don't hide launch storyboard on iOS until game is fully loaded · Stencyl/[email protected] · GitHub

  3. The game is now responsible for hiding the launch storyboard at an appropriate time (once your first screen is loaded).

    Don't hide launch storyboard on iOS until game is fully loaded · Stencyl/[email protected] · GitHub

The reason I never went through with this in the end is because there was some strange behavior related to backgrounding and resuming the app, though I can’t recall exactly what it was unfortunately. It was perhaps related to the preview image of the backgrounded app?

1 Like

I wonder also if it is a true black screen, or the background color

Thanks so much for this insight @justin_espedal.