iosuikit-state-preservation

IOS state preservation: can I display a launch image instead of a snapshot


Question: When working with IOS state preservation, how can I display a custom launch image instead of the snapshot during the launching process

Description: I am working on IOS state preservation. Everything works fine except that every time I reopen the APP after killing it, the first thing the APP displays is the snapshot of the screen when the app enters background. I have a map view showing user's current location. I don't want the app to show the snapshot of an old location during launching and then jump to the current location. Is there some method to show a custom launch image during the launching process.


Solution

  • See the documentation for ignoreSnapshotOnNextApplicationLaunch :

    As part of the state preservation process, UIKit captures your app’s user interface and stores it in an image file. When your app is relaunched, the system displays this snapshot image in place of your app’s default launch image to preserve the notion that your app was still running. If you feel that the snapshot cannot correctly reflect your app’s user interface when your app is relaunched, you can call this method to prevent that snapshot image from being taken. If you do, UIKit uses your app’s default launch image instead.

    You must call this method from within the code you use to preserve your app’s state.