Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Saving game progress with NSUserDefault: Good or Bad idea?

I'm working on a game and all progress the user makes will be saved with NSUserDefaults. Is it a good or bad idea???

What are the chances of losing the game saved? Is there a better way to do this?

When the user syncs the device, iTunes will backup NSUserDefaults? So in case the user changes his device he will not lose the progress, he just has to sync the device with iTunes? How safe is it?

GameCenter achievements will be saved with NSUserDefaults as well, in case the user doesn't have an internet connection at the time.

Well, I just wanna know your opinion/experience. All code is working flawless, but I'm afraid the player might lose his progress for some reason.

If anyone wants more details on the code fell free to ask, I can post it here.

Thanks!

like image 445
tomDev Avatar asked Oct 21 '11 03:10

tomDev


2 Answers

NSUserDefaults are synced to iTunes if the user syncs the app. The data is safe as long as the user does not delete the game.

If you need to preserve the data even after the user deletes the game, you may consider saving the data somewhere else (say, Dropbox, own server, etc.)

like image 22
ohho Avatar answered Oct 21 '22 10:10

ohho


In my opinion, NSUserDefaults is perfectly safe. The contents are even maintained after a version update of the app.

like image 129
Akshay Avatar answered Oct 21 '22 10:10

Akshay