我正在使用 JSONMODEl ( https://github.com/icanzilb/JSONModel ) 来解析 wordpress JSON FEED (with json-api)。
一切顺利,除非我想要“评论”。
我的饲料是这样的:
comments = (
{
content = "<p>My comment</p>\n";
date = "2014-08-29 20:56:29";
id = 97813;
name = johndoe;
parent = 0;
url = "http://www.google.com";
}
);
所以我试着让我的“新闻模特”像这样:
#import "JSONModel.h"
#import "commentmodel.h"
@protocol NewsModel @end
@interface NewsModel : JSONModel
@property (strong, nonatomic) NSString* title;
@property (strong, nonatomic) NSString* content;
@property (strong, nonatomic) NSString* thumbnail_images;
@property (strong, nonatomic) NSString* premium;
@property (strong, nonatomic) NSString* id;
@property (strong, nonatomic) CommentModel* comments;
@end
我的评论模型就是这样
#import "JSONModel.h"
@interface CommentModel : JSONModel
@property (assign, nonatomic) int id;
@property (strong, nonatomic) NSString* name;
@property (assign, nonatomic) NSString* content;
@end
但是当我尝试构建我的应用程序时,我的“提要”是空的。
如果我评论新闻模型的“评论”部分,我得到了内容....
我想我被困在某个地方,但是在哪里!如果有人有想法:)
非常感谢