Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My game uses cocos2d-x and will be published on iOS platform first, later on Android. I save a lot of things with CCUserDefault (scores, which level was completed, number of coins taken, etc...). But now I have a big doubt.

What will happen when the game will receive its first update?

CCUserDefault uses an XML file stored somewhere in the app storage space. This file is created and retained until one uninstalls the app. I am wondering what happens when the app is updated. Will the old XML file be maintained?

Because if not, how should I handle app updates (updates in the sense that 2, 3 or more new level packages will be added, but the informations about the old ones, like scores, which level was finished and which not, number of coins, etc., need absolutely not to be lost)?

share|improve this question

Ok, i found the answer. CCUserDefault stores the xml file under:


The iOS App Programming Guide states that all the data under



will be preserved. That is, after the update, your userdefault.xml file will be still there

share|improve this answer

Here's a similar question on stackoverflow regarding NSUserDefaults which I would assume CCUserDefault emulates or inherites

share|improve this answer

Your .xml file will be there after updating.

The exact path in iOS is

/Users/yourusername/Library/Application Support/iPhone Simulator/(select your     
version)7.0.3/Applications/(something like this)9C9FF1EB-0674-4FA9-A113    

Open this plist and you can see the key and associated stored value.

Make sure to keep your library folder unhidden by running this in the terminal:

chflags nohidden ~/Library 

I don't know about Android.

share|improve this answer

Your Answer


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.