CCUserDefault flush, CFPreferences Background Sync Queue

124 Views Asked by At

We developed a game using cocos2dx framework. Our app crashed in following line (not all the time, around 1 in 20 times). Can you please help us to identify the issue.

CCUserDefault::sharedUserDefault()->setIntegerForKey("NetWorth", netWorth);        
CCUserDefault::sharedUserDefault()->flush();

crash log: Crashed: CFPreferences Background Sync Queue EXC_BAD_ACCESS UNKNOWN at 0x006a5936 raw 0 CoreFoundation __CFTypeCollectionRetain + 7 1 CoreFoundation _CFArrayReplaceValues + 260 2 CoreFoundation _CFArrayReplaceValues + 260 .... OilTycoon GamePlayScene.cpp line 11525 GamePlayScene::getNetWorth()

1

There are 1 best solutions below

0
On

You seem to be using a deprecated method. Check out the sample in cpp-tests for correct usage.