12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- //
- // AccountModel.m
- // CommerceManage
- //
- // Created by 小花 on 2016/12/27.
- // Copyright © 2016年 vaic. All rights reserved.
- //
- #import "AccountModel.h"
- @implementation AccountModel
- //+ (instancetype)AccountStatusWithDict:(NSDictionary *)dict {
- // AccountModel *account = [[self alloc] init];
- // account.token = dict[@"token"];
- //
- // return account;
- //}
- /**
- * 当一个对象要归档进沙盒的时候就会调用 归档
- * 目的,在这个方法中说明这个对象的哪些属性写进沙盒
- * @param encoder <#encoder description#>
- */
- - (void)encodeWithCoder:(NSCoder *)encoder
- {
-
- [encoder encodeObject:self.token forKey:@"token"];
- [encoder encodeObject:self.unionid forKey:@"unionid"];
- [encoder encodeObject:self.openId forKey:@"openId"];
- //
- }
- /**
- * 反归档 的时候会调用这个方法 解档
- * 目的:在这个方法中说明这个对象的哪些属性从沙河中解析出来
- 从沙河中解析对象 反归档会调用这个方法 需要解析哪些属性
- * @param decoder <#decoder description#>
- *
- * @return <#return value description#>
- */
- -(instancetype)initWithCoder:(NSCoder *)decoder
- {
- if (self = [super init]) {
- self.token = [decoder decodeObjectForKey:@"token"];
- self.unionid = [decoder decodeObjectForKey:@"unionid"];
- self.openId = [decoder decodeObjectForKey:@"openId"];
- }
- return self;
- }
- @end
|