Cocos2d-x 3.1.1 Study Notes [14] UserDefault user data storage, cocos2d3.1.1

Source: Internet
Author: User

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


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.