CCUserDefaults broken on iPad3

CCUserDefaults works on iPad2 but not iPad3. Is this a known issue?

I temporarily using NSUserDefaults instead of CCUserDefaults to avoid this issue.

Hey, can someone else confirm this? A bit of a concern to me, I just submitted my game to Apple and I use CCUserDefaults, I don’t own an iPad 3 to test this on. This works fine on the latest simulator and 5.1 iOS.

Zhi - what version of Cocos2d-x are you using? What iOS version is the iPad 3? Can you confirm the code below (a really simple value save) doesn’t work?

    CCUserDefault * saveFile = CCUserDefault::sharedUserDefault();
    int iVolume = 50;
    saveFile->setIntegerForKey("sound_volume", iVolume);
    iVolume = saveFile->getIntegerForKey("sound_volume", 80);

Does the iVolume at least end up with the default value 80?

I’d rather not have to buy another $500 iPad (I’ve spent enough time and money on Apple hardware already haha).

I don’t know the meaning of “broken”.
I can run CCUserDefaultTest in my new ipad.

I don’t know, it just doesn’t save. Restart the app, everything gone. Works perfectly well on ipad2 though. Now I’ve changed to NSUserDefaults. Strange.

try to call flush after writing.

@
CCUserDefault::flush();
@

Call,
CCUserDefault::sharedUserDefault()->flush();
After writing any new data.

1 Like

i am facing the same problem

@ Utility::setUnlockedLevel(8);
CCUserDefault::sharedUserDefault()->flush();@

and in utility

`void Utility::setUnlockedLevel(int level) {
CCUserDefault *defaults = CCUserDefault::sharedUserDefault();
defaults->setIntegerForKey(kUnlockedLevelKey, level);
CCUserDefault::sharedUserDefault()->flush();
}

int Utility::getUnlockedLevel(){
return CCUserDefault::sharedUserDefault()->getIntegerForKey(kUnlockedLevelKey);
}
`

but it is returning garbage value on android whereas correct value in iphone……. Can somebody tell me the problem