cocos2d::UserDefault::synchronize()

cocos2d::UserDefault::synchronize()
0

#1

Hello,

is there a way to force UserDefault saved data syncronization as we used to do in Objective-C?

[[NSUserDefaults standardUserDefaults] synchronize];

MandarX


#2

I suggest you use SQLite instead of UserDefault :wink:


#3

Use the flush() method.


#4

Thank you for the answer

I suggest you use SQLite

I will, but I am porting some old Objective C projects to C++ and I want to finish as soon as possible.


#5

thank you!


#6

An explanation why to use SQLite instead of UserDefaults/Preferences would be nice. SQLite has more overhead, because you need to maintain all tables and if you don’t use it correct, the file will be deleted and recreated, so everything is lost. In UserDefaults/Preferences nothing will be lost that easy.

For an easy key/value store, the UserDefaults/Preferences are fine IMHO.