我对这个库和我的对象有一些问题,我有3种对象: 页面,小部件,画廊
page:
int
string
dictionary of widget
widget:
int
string
dictionary gallery
gallery
int
string
array page
我创建了所有协议,所以我创建了类似的东西:
page:
import widget
int
string
dict<Widget>
widget
import gallery
int
string
Gallery
dict<Gallery>
Gallery
import page
int
string
array<Page>
我创建委托后,所有这些我得到“unknow type”错误,无法找到协议......错误在哪里?
答案 0 :(得分:0)
您需要定义协议并导入头文件
//Page.h
@protocol Page
@end
@class Widget;
@interface Page : JSONModel
@property (nonatomic, assign) NSInteger pageID;
@property (nonatomic, strong) NSString *name;
@property (nonatomic, strong) Widget *widget;
//Widget.h
@class Gallery;
@interface Widget : JSONModel
@property (nonatomic, assign) NSInteger widgetID;
@property (nonatomic, strong) NSString *name;
@property (nonatomic, strong) Gallery *gallery;
//Gallery.h
#import "Page.h"
@interface Gallery : JSONModel
@property (nonatomic, assign) NSInteger galleryID;
@property (nonatomic, strong) NSString *name;
@property (nonatomic, strong) NSArray<Page>* pages;