//用户模型
#import <Foundation/Foundation.h>
/**
* id int64 用户UID
idstr string 字符串型的用户UID
screen_name string 用户昵称
name string 友好显示名称
province int 用户所在省级ID
city int 用户所在城市ID
location string 用户所在地
description string 用户个人描述
url string 用户博客地址
profile_image_url string 用户头像地址(中图),50×50像素
profile_url string 用户的微博统一URL地址
*/
@interface QHUser : NSObject
/** string 字符串型的用户UID*/
@property(nonatomic,copy)NSString *name;
/** string 字符串型的用户UID*/
@property(nonatomic,copy)NSString *idstr;
/**string 用户头像地址(中图),50×50像素*/
@property(nonatomic,copy)NSString *profile_image_url;
+ (instancetype)userWithDict:(NSDictionary *)dict;
@end
#import "QHUser.h"
@implementation QHUser
+ (instancetype)userWithDict:(NSDictionary *)dict
{
QHUser *user = [[self alloc]init];
user.idstr = dict[@"idstr"];
user.name = dict[@"name"];
user.profile_image_url = dict[@"profile_image_url"];
return user;
}
@end
#import <Foundation/Foundation.h>
/**
*
idstr string 字符串型的微博ID
text string 微博信息内容
source string 微博来源
favorited boolean 是否已收藏,true:是,false:否
truncated boolean 是否被截断,true:是,false:否
in_reply_to_status_id string (暂未支持)回复ID
in_reply_to_user_id string (暂未支持)回复人UID
in_reply_to_screen_name string (暂未支持)回复人昵称
thumbnail_pic string 缩略图片地址,没有时不返回此字段
bmiddle_pic string 中等尺寸图片地址,没有时不返回此字段
original_pic string 原始图片地址,没有时不返回此字段
geo object 地理信息字段 详细
user object 微博作者的用户信息字段 详细
retweeted_status object 被转发的原微博信息字段,当该微博为转发微博时返回
*/
@class QHUser;
@interface QHStatus : NSObject
/** string 字符串型的微博ID*/
@property(nonatomic,copy)NSString *idstr;
/** string 微博信息内容*/
@property(nonatomic,copy)NSString *text;
/** object 微博作者的用户信息字段 详细*/
@property(nonatomic,strong)QHUser *user;
+ (instancetype)statusWithDict:(NSDictionary *)dict;
@end
#warning 注意这里模型里面嵌套模型的处理方法
#import "QHStatus.h"
#import "QHUser.h"
@implementation QHStatus
+ (instancetype)statusWithDict:(NSDictionary *)dict
{
QHStatus *status = [[self alloc]init];
status.idstr =dict[@"idstr"];
status.text = dict[@"text"];
status.user = [QHUser userWithDict:dict[@"user"]];
return status;
}
@end