0

I have some problem with this library and my objects,I have 3 kind of object: page, widget, gallery

page:
int
string
dictionary of widget

widget:
int
string 
dictionary gallery

gallery
int
string
array page

I create all protocol so I create something like:

        page:
        import widget
        int
        string
        dict<Widget>

        widget
        import gallery
        int
        string
        Gallery
        dict<Gallery>

        Gallery
        import page
        int
        string
        array<Page>

after I create delegate and all this I get "unknow type" error and cannot find protocol...where is the error?

francesco.venica
  • 1,703
  • 2
  • 19
  • 54

1 Answers1

0

You need to define protocol and import the header file

//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;
Anupdas
  • 10,211
  • 2
  • 35
  • 60