archivedDataWithRootObject 存储 BusinessCard *bc = [[BusinessCard alloc] init];
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
NSData *udObject = [NSKeyedArchiver archivedDataWithRootObject:bc];
[ud setObject:udObject forKey:@"myBusinessCard"];
udObject = nil;
udObject = [ud objectForKey:@"myBusinessCard"];
bc = [NSKeyedUnarchiver unarchiveObjectWithData:udObject] ;
相关文章
- 02-19NSUserDefaults standardUserDefaults使用注意事项
- 02-19数据存储简单了解(NSUserDefaults)
- 02-19archivedDataWithRootObject NSUserDefaults
- 02-19利用NSUserdefaults来存储自定义的NSObject类及自定义类数组
- 02-19高级UIKit-04(NSUserDefaults、NSKeyedArchiver、对象归档方法)
- 02-19NSUserDefaults registerDefaults
- 02-19NSUserDefaults 可以保存哪些类型
- 02-19数据存储之偏好设置NSUserDefaults
- 02-19Swift - 使用NSUserDefaults来进行本地数据存储
- 02-19ios中NSUserDefaults的使用方法