iOS - The splash screen shows every time I collapse the app and open it back after 3 to 4 hours

The real test would be to collapse the app and then open it after 5-6 hours. The splash screen opens again.

Replies

That’s not unusual. Once the user has moved your app to the background the OS will typically suspended it within a few seconds. Once suspended it may be terminated by the OS to recover memory for other apps. It’s pretty unusual for an app to not be terminate after 5 to 6 hours (although it can happen if your app is small and the system is not under memory pressure).

The solution here is to minimise the impact of being terminating by:

  • Using a launch screen, not a splash screen (the latter emphasises the fact that your app was terminated)

  • Implementing state restoration, so your app comes back to where the user left off

You should also look at reducing your app’s memory usage when it gets moved to the background. The less memory it uses the less likely it is to be suspended.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

WWDC runs Mon, 5 Jun through to Fri, 9 Jun. During that time all of DTS will be at the conference, helping folks out face-to-face. http://developer.apple.com/wwdc/

Yes, I have used LaunchScreen.storyboard already. And my app is music player.

Let me see if I understand this...I don't believe you can, or want to, "use a launch screen rather than a splash screen" unless the app is terminated and if the app is terminated the system does that for you. And, if you do this with state restoration, the launch screen (not the splash screen) will be the one that "emphasises the fact that the app was terminated."


Here's my understanding:

An app runs. A user 'collapses' it - that is the user presses the Home button and does something else with their device. This moves the App into the background, aka suspends the App, but does not necessarily terminate the app. Before going into the background the system records a splashscreen of what is being displayed. (The app could rejigger its display just before it gets suspended and then the Splashscreen would be different from what was being displayed before being suspended.) When the user taps on the app, the app moves back into foreground. The system displays the splashscreen as it is moving the app into foreground. The splashscreen (or the rejiggered splashscreen) typically looks like the app will look once the app is back in the foreground.

The app might be terminated while in the background. (We can debate whether this happens often or not.) If that happens then the next time the app is tapped the app relaunches itself. The splash screen is gone. If there is a launch screen then the launch screen, not the splashscreen, is displayed while the app is being launched. If there is no launch screen then the app displays a black screen until it is launched. A black screen is bad if you are starting out on a 'Level 0' - a launch screen showing 'Level 0' would be better. If the app stores its current status it can start you where you left off (i.e. you get restarted on 'Level 6' not 'Level 0' if you were on 'Level 6' when you suspended the app). However, in this case you may not want to use a launch screen that shows 'Level 0' - you might prefer a black screen. (Here I disagree - I prefer the Level 0 launch screen that switches to Level 6 if the app was terminated while in the background, IMHO.)

Post not yet marked as solved Up vote reply of PBK Down vote reply of PBK