Cocos2d-x 3.1.1 Study Notes [14] UserDefault user data storage, cocos2d3.1.1
// Get UserDefault instance auto ud = UserDefault: getInstance (); // set the key value pair ud-> setStringForKey ("name", "zhouyunxuan "); // perform the flush ud-> flush (); // obtain the storage data log ("name is % s", ud-> getStringForKey ("name "). c_str (); // name is zhouyunxuan // set the default value for the stored data. If the key does not have a corresponding value, the default value is returned. Log ("password is % s", ud-> getStringForKey ("password", "default name"). c_str (); // password is default name
D.dxy.cn/detail/6494373
Cocos2d-x using sqlite database, in win32 did not ask you, sqlite3_open under ios can not create a database, the returned value is 14
The db file path is incorrect.
Ios does not support file modification except the document directory