# iPhone game - saving player state data

I am developing my first app for iPhone, using C++ and some Objective C code to interface with ios sdk api. My app is obviously a game. I was wondering where to save the state of the player (in my case, i want to save something like the number and identification label of every level finished, the score made at a level, how many stars taken, how many hidden item discovered and so on). My idea is to create (if it does not exist yet) a temp directory somewhere (is there a c: drive?). The temp directory will be there till the disinstallation of the game. In the temp directory, i will save all the relevant info. Is this the right way to handle this situation?

Ps. I see the reason for the downvote. I forget to specify that my app needs to run on different systems (iphone, android and so on...). I would like to employ a more portable technique...

• – MichaelHouse Jul 12 '12 at 19:40
• How will you run your objective C game on "Android and so on..."? If you were to figure that out, you can detect which operating system you're running on and take the action appropriate for that OS. See the duplicates linked for iOS, then when you get to "Android and so on..." you can search this site for those answers, as I'm sure those have been asked before as well. – MichaelHouse Jul 17 '12 at 23:35

NSArray *documentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);