In objective-C i made 11 classes which subclass RLMObject to represent the model of my database. And as of now I have a problem building my App with this, because as stated in the title, they seem to not see each other. Additionally: they are in the same folder, the #import does not make any problems itself.
As a sample I want to provide two classes The following is the class for Books:
#import <Realm/Realm.h>
#import "Chapter.h"
@interface Book : RLMObject
@property NSInteger id;
@property NSString *name;
@property RLMArray<Chapter> *chapters;
@end
// This protocol enables typed collections. i.e.:
// RLMArray<Book>
RLM_ARRAY_TYPE(Book)
The following would be my class for chapters:
#import <Realm/Realm.h>
@class Book;
@interface Chapter : RLMObject
@property NSInteger id;
@property NSString *name;
@property Book *book;
@end
// This protocol enables typed collections. i.e.:
// RLMArray<Chapter>
RLM_ARRAY_TYPE(Chapter)
In Book.h I get:
Cannot find protocol declaration for 'Chapter'
Does anybody have an idea? It is definitely some kind of import circle. But how can I resolve it? If not necessary I would like to avoid putting all of the model-classes in a prefix header.
EDIT: a @class import helped in the chapter-file, but it doesn't in the Book-file