I am looking for the best way to store data in a game. Currently I have like 30 different variables which do different things in my game. I only need these variables to be remembered for when the app is open, once it closes all of these variables get reset. The way I was doing it currently, was using NSUserDefaults but it just gets too confusing and annoying at this point.
Can anyone tell me how I should go upon this? And if so, a link on how to do it would be helpful too!
You can create your variables in your
appdelegateclass.As the scope of your
appdelegateclass is through out your application and when you want to use those variables you can just share them with different class.And as your requirement is that the variables needs to be remembered once, this approach will do exactly the same and as soon your app is close the scope of
appdelegatewill be over too and thus they will get released and when you launch your game again they will surely fetch new value.:)