1.创建一个账号数据模型 用来存放从服务器返回的数据,一般返回的是一个字典,里面包含了这个登陆用户的各种信息,这个数据模型就是用来存放这些东西的
创建一个数据模型 YYCAccount 继承 NSObject 注意要遵守<NSCoding>协议
YYCAccount.h文件中代码 这里面字段根据返回的数据写,一般写能用的上的就行了,不需要的不用写
1 #import <Foundation/Foundation.h> 2 3 @interface YYCAccount : NSObject <NSCoding> 4 /** 5 * 用户ID 6 */ 7 @property (nonatomic, assign) int uid; 8 /** 9 * 用户姓名 10 */ 11 @property (nonatomic, copy) NSString *name; 12 /** 13 * 手机号 14 */ 15 @property (nonatomic, copy) NSString *tel; 16 /** 17 * 出生日期 18 */ 19 @property (nonatomic, copy) NSString *birthday; 20 /** 21 * 性别 22 */ 23 @property (nonatomic, copy) NSString *sex; 24 /** 25 * 图片存放目录 26 */ 27 @property (nonatomic, copy) NSString *category; 28 /** 29 * 用户密码 30 */ 31 @property (nonatomic, copy) NSString *password; 32 /** 33 * 优惠券数量 34 */ 35 @property (nonatomic, assign) int counum; 36 /** 37 * 爱牙指数 38 */ 39 @property (nonatomic, assign) int level; 40 /** 41 * 图片名称 42 */ 43 @property (nonatomic, copy) NSString *filename; 44 45 /** 46 * 积分 47 */ 48 @property (nonatomic, assign) int integral; 49 /** 50 * 签到总天数 51 */ 52 @property (nonatomic, assign) int alldays; 53 54 /** 55 * 上次签到时间 56 */ 57 @property (nonatomic, copy) NSString *lastCheckinTime; 58 59 60 /** 61 * 用来加载字典 账户信息 62 * 63 * @param dict <#dict description#> 64 * 65 * @return <#return value description#> 66 */ 67 +(instancetype)AccountStatusWithDict: (NSDictionary *)dict; 68 69 70 71 @end