Norway


I am having a bit of a problem with 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 API.

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 run 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 code referencing Message, it compiles normally.

#import <JSONModel/JSONModel.h>

@protocol Messages;
@interface Messages : JSONModel
@property (nonatomic) NSString<Optional>* id;
@property (nonatomic) NSString<Optional>* sender_id;
@property (nonatomic) NSString<Optional>* receiver_id;
@property (nonatomic) NSString<Optional>* user_user_id;
@property (nonatomic) NSString<Optional>* job_id;
@property (nonatomic) NSString<Optional>* file_id;
@property (nonatomic) NSString<Optional>* title;
@property (nonatomic) NSString<Optional>* replied;
@end






@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>  *items;
@end

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



Source link

LEAVE A REPLY

Please enter your comment!
Please enter your name here