Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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...

share|improve this question
3  
1  
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. –  Byte56 Jul 17 '12 at 23:35
add comment

1 Answer

there is no C: Drive in this Case, but in Objective-c you could use the DocumentDirectory of your application.

NSArray *documentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDir = [documentPaths objectAtIndex:0];

So you get the path to the Document directory of your app. In this directory you can save your files.

Edit: if someone downvote, please submit the reason in a comment.

share|improve this answer
    
No downvoters comments, upvoting... –  Markus von Broady Oct 4 '12 at 20:11
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.