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.

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

3 Answers 3

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

http://stackoverflow.com/questions/1638766/do-nsuserdefaults-persist-through-an-update-to-an-app-in-the-appstore

share|improve this answer

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

application_home/library/caches

The iOS App Programming Guide states that all the data under

application_home/document

application_home/library

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

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    
D9E3DAD7B2CB/Library/Preferences/com.yourcompany.projectname.plist

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

 
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.