I am wondering how to save a users progress in a quiz game. Right now if the user closes the app he has to start at question 1 again. Any answers would be appreciated.
How to save a users progress in quiz game
Add a Comment
I am wondering how to save a users progress in a quiz game. Right now if the user closes the app he has to start at question 1 again. Any answers would be appreciated.
The usual way, assuming there's not a huge amount of information to save, is to store it in user defaults:
https://developer.apple.com/documentation/foundation/userdefaults
You can save all of the information in a blob under one key, or split it up into values stored in multiple keys, as you wish.
iOS? The game might be played by the same user across different devices, so, take a look at using
NSUbiquitousKeyValueStore
to store the game state in the user's iCloud data. That way, game status can continue where left off regardless of which device they use, and protected should they delete the game/app, which won't occur using defaults.