0

I have a fairly simple class that represents a game being created by a player for another player, before they game is sent to the other player by the server I would like to implement a sort of persistence in case something goes wrong i.e a crash. So the current state of the game they are creating is saved so they can just resume creation if something goes awry.

Looking through the various ways to save objects and such it seems, NScoding with NSKeyedarchiver is my best bet as it is not a massive amount of data... My question is can you then delete anything saved though NSCoding? as i do not want to retain the object on the phone once it has been successfully sent to the other player as at the moment my thought's are to check if there is anything saved on start up and if there is anything it represents a game in creation unfinished, this is also assuming i am saving to [NSUserDefaults standardUserDefaults].

Another question can you save more than one of the same object to standardUserDefaults and it knows how to differentiate between them or do they just override? if this is the case i may have to consider unique file paths for each.

there are many other questions but these are the most important ones and will hopefully convey my idea across enough to get a some what clear answer.

Thanks in advance.

EDIT: So i know you can delete docs so this may pretty much be answered i will report back when i get it working in the meantime any insights would still be helpful as to maybe speed up my approach.

Genhain
  • 1,937
  • 1
  • 19
  • 38

1 Answers1

0

So yeah You can save and delete outside of NSuserDefaults no problem...If you would like to know how here

http://www.raywenderlich.com/1914/how-to-save-your-app-data-with-nscoding-and-nsfilemanager

This helped immensely

Genhain
  • 1,937
  • 1
  • 19
  • 38