- XML属性列表(plist)归档
NSArray *arr1 = @[@"a",@"b",@"c"];
NSString *filePath = @"xxx.data";
// 存储
[arr1 writeToFile:filePath atomically:YES];
// 读取
NSArray *arr2 = [NSArray arrayWithContentsOfFile:filePath];
- Preference(偏好设置)
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults]
// 存储
[userDefaults setObject:@"chaselen" forKey:@"username"];
[userDefaults setBool:YES forKey:@"rememberPwd"];
// 读取
NSString *username = [userDefaults objectForKey:@"username"];
BOOL rememberPwd = [userDefaults BoolForKey:@"rememberPwd"];
-
NSKeyedArchiver归档(NSCoding)
自定义的类遵守
<NSCoding>
协议(实现encodeWithCoder
方法和initWithCoder
方法) SQLite3
Core Data