// // 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"]; [encoder encodeObject:self.nickname forKey:@"nickname"]; // } /** * 反归档 的时候会调用这个方法 解档 * 目的:在这个方法中说明这个对象的哪些属性从沙河中解析出来 从沙河中解析对象 反归档会调用这个方法 需要解析哪些属性 * @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"]; self.nickname = [decoder decodeObjectForKey:@"nickname"]; } return self; } @end