Zhe Wang wrote:
You need to call CCUserDefault::flush() to persistent all datas in memory.
Please try to add @ CCUserDefault::sharedUserDefault()->flush(); @ into AppDelegate:applicationDidEnterBackground();
Well,it’s not the reason.
In version 2.0.4, I guess may be the libxml will clean the data before write new one, so when the device suddenly shut down before the data be writen will cause the userdefault.xml empty,
and the code can’t find the rootnode, then break,the game will never store data after the problem appears except going into the setting of the device and clean the data.
Now I use the 2.1.3, you drop the libxml and pick up the tinyxml,and store the data use sharedpreference(android),I tried to clean the data of the xml but not delete the xml,found it was ok,
can be writen again.But I’m not sure when I store many data often will slow down the speed(I tested in 2.0.4, i9100,very slow).Hope running well:) .