I am having a bit of a problem with custom into my viewController.

I have created a Message Object that holds the json response from the server.
I then created a MessageManager class, that does all of the network calls to the .

MessageManager imports Message, to create the message object and pass it off to whatever class is using it.

I now have my viewController class, which #import both MessageManager and Message. so I can create an instance variable of Message.
However I into duplicate symbol errors with the compiler.

How do I get around this issue, and have the correct sequence of imports.

If i remove the Message.h from the viewcontroller, and remove any referencing Message, it compiles normally.

#import <JSONModel/JSONModel.h>

@protocol Messages;
@interface Messages : JSONModel
@property (nonatomic) NSString<Optional>* ;
@property (nonatomic) NSString<Optional>* sender_;
@property (nonatomic) NSString<Optional>* receiver_;
@property (nonatomic) NSString<Optional>* user_user_;
@property (nonatomic) NSString<Optional>* job_;
@property (nonatomic) NSString<Optional>* file_;
@property (nonatomic) NSString<Optional>* title;
@property (nonatomic) NSString<Optional>* replied;

@protocol MessagesModel;
@interface MessagesModel : JSONModel
@property (nonatomic) NSString<Optional>* action;
@property (nonatomic) NSDate<Optional>* dateTime;
@property (nonatomic) NSString<Optional>* result;
@property (nonatomic) NSString<Optional>* numItems;
@property (nonatomic) NSArray <Messages>  *;

@implementation MessagesModel
+ (JSONKeyMapper *)keyMapper
    return [JSONKeyMapper mapperForSnakeCase];

Source link


Please enter your comment!
Please enter your name here