本地存储NSUserdefault封装(可存储各种类型),简单易用。
调用方法:
#import "ViewController.h"
#import "StudentModel.h"
#import "InfoModel.h"
#import "NSObject+JKLocalStore.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
StudentModel *student = [[StudentModel alloc] init];
student.name = @"A";
NSArray *array = @[[InfoModel new], [InfoModel new], [InfoModel new]];
student.datas = array;
[student localStoreWithKey:@"FastCoding"];
StudentModel *tmpStudent = [StudentModel valueWithKey:@"FastCoding"];
NSLog(@"%@", tmpStudent.name);
NSLog(@"%@", tmpStudent.datas);
}
2022-11-30 21:43:49
17KB
本地存储
1