第一方法
SystemHeader.h
#define SaveStringToXML CCUserDefault::sharedUserDefault()->setStringForKey
#define SaveIntegerToXML CCUserDefault::sharedUserDefault()->setIntegerForKey
#define SaveBooleanToXML CCUserDefault::sharedUserDefault()->setBoolForKey
#define LoadStringFromXML CCUserDefault::sharedUserDefault()->getStringForKey
#define LoadIntegerFromXML CCUserDefault::sharedUserDefault()->getIntegerForKey
#define LoadBooleanFromXML CCUserDefault::sharedUserDefault()->getBoolForKey
实用例子
SaveStringToXML("name","dengao");
CCUserDefault::sharedUserDefault()->flush();//写了东西要提交
std::string name = LoadStringFromXML("name");
log("name: %s ",name.c_str());
数据保存的地方
log("%s",FileUtils::getInstance()->getWritablePath().c_str());
第二种方法
CCUserDefault::sharedUserDefault()->setStringForKey("name","dengao");
std::string name = CCUserDefault::sharedUserDefault()->getStringForKey("name");
log("name: %s ",name.c_str());