Database problem.

hey i have just completed developing a game with marmalade and cocos2dx and it runs well.
the only problem i am having is with the database.
i am using CCUSERDEFAULTS.
when i play the game the database is maintained properly but if i close the game and again restart it the it loads from the beginning instead of loading from where i left it.
i am not resetting the database.
still this is happening.

any solutions to it.

thank you very much in advance.

Can you show us the part of your code where you load your data?

I usually add an additional boolean called “ALREADY_INIT” and when the game starts, i check if that is true and load the saved data, if it is not, i load the default values.

Lance Gray wrote:

Can you show us the part of your code where you load your data?
>
I usually add an additional boolean called “ALREADY_INIT” and when the game starts, i check if that is true and load the saved data, if it is not, i load the default values.

Even i have used a boolean called fistlaunch.
when the game is launched first time, it will set different values required in function called reset database…

i have attached the code for it.

Do you call the flush method after you setted the data?

dbCatapult~~>setIntegerForKey;
dbCatapult~~>flush();

This method saves the content to the xml file.
http://www.cocos2d-x.org/reference/native-cpp/d0/d79/classcocos2d_1_1_c_c_user_default.html