标签:
比如存入再读出一个字符串到NSUserDefaults:
//写入本地
[[NSUserDefaults standardUserDefaults] setObject:@"hahaha" forKey:@"myKey"];
//获得此key的值
NSString *value = [[NSUserDefaults standardUserDefaults] objectForKey:"myKey"];
//清空本地此key的值
[[NSUserDefaults standardUserDefaults] setObject:nil forKey:@"myKey"];
但是并不是所有的东西都能往里放的。NSUserDefaults只支持: NSString, NSNumber, NSDate, NSArray, NSDictionary.
标签:
原文地址:http://www.cnblogs.com/huangzs/p/4463225.html