标签:
// 向plist文件中存储数据
NSString *home = NSHomeDirectory();
NSString *docPath = [home stringByAppendingPathComponent:@"Document"];
NSArray *data = @[@"jack", @10, @"ffdsf"];
NSString *filePath = [docPath stringByAppendPathComponent:@"data.plist"];
[data writeToFile:filePath atomically:YES];
// 偏好设置存储数据
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject:@"mj" forKey:@"account"];
[defaults setInteger:10 forKey:@"age"];
[defaults setBool:YES forKey:@"auto_login"];
[defaults synchronize];
NSString *account = [defaults objectForKey:@"account"];
标签:
原文地址:http://www.cnblogs.com/lianfu/p/5256348.html