//保持到本地数据
NSArray *array=@[@"234",@"sdfe"];
NSUserDefaults *userDefault=[NSUserDefaults standardUserDefaults];
[userDefault setInteger:123 forKey:@"number"];
[userDefault setObject:array forKey:@"array"];
[userDefault synchronize];
//获取保持到数据
NSUserDefaults *userdefault2=[NSUserDefaults standardUserDefaults];
NSInteger number2=[userdefault2 integerForKey:@"number"];
NSArray *array2=[userdefault2 objectForKey:@"array"];
NSLog(@"number=%d,array=%@",number2,array2);
UserDefault的使用,保存小数据到本地,布布扣,bubuko.com
原文地址:http://www.cnblogs.com/clarence/p/3916768.html