前言:一般情况下我们经常会使用到小数据的存储,这是我们可以选择 NSUserDefaultsl来进行
首先要注意几点就是: NSUserDefaultsl 只能保存可变的数据,如果你要保存的数据为不可变的则
NSUserDefaults *userDFRegister = [NSUserDefaults standardUserDefaults];
// 取出数据
NSMutableDictionary *registDic = [NSMutableDictionary dictionaryWithDictionary:[userDFRegister objectForKey:@"register"]];
// 存储进入数据
[registDic setObject:data forKey:@"card_front"];
NSDictionary *tmp = [NSDictionary dictionaryWithDictionary:registDic];
[userDFRegister setObject:tmp forKey:@"register"];
[userDFRegister synchronize];