With iOS “multitasking” a running app’s state is saved when the user starts another app, and in theory when the user restarts the saved app it should start exactly where it was stopped before.
However, I have noticed that some games does not always recover their previous state, and instead reloads from the beginning. For example Bloons TD. Sometimes when I am in the middle of a game and switches back and forth between apps I will get back to where I was, sometimes the game restarts. It’s not clear to me why it restarts sometimes but not always.
I am making an opengl based game, and I’d like to know if there is a way to ensure the game state is always saved properly? What I want to avoid is to make a game save/load system myself, if possible.
Implement the methods:
in the
AppDelegateso that if the app enters the background, save the current game state, and if the game becomes active again, load the current game state. Hope that Helps!