alex440
alex440

Reputation: 1657

JSONMODEL iOS error JSONValueTransformer JSONObjectFrom not found

I have a fairly simple JSONModel class in .h file

@class MyInnerModel;
@protocol MyModel <NSObject> @end
@interface MyModel:JSONModel
@property(nonatomic,assign)NSInteger _id;
@property(nonatomic,strong)NSString *type;
@property(nonatomic,strong)MyInnerModel *innerModel;
@end 
@protocol MyInnerModel <NSObject> @end 
@interface MyInnerModel :JSONModel
@property (nonatomic,strong)NSString *stam;
@end

in .m file

@implementation MyModel @end
@implementation MyInnerModel @end

then i get some json in an http request and do

JSONModelError *error = nil;
MyModel *output = [[MyModel alloc] initWithString:json error:&error];
if(error){
LogInfo(@"Error creating output,%@",[error description]);
return nil;
}

This works perfectly during normal runtime.

but when i try to run it during unit testing, i get the following :

2014-10-30 10:41:49.805 MyApp[61195:489073] [JSONModel.m:990] EXCEPTION: [JSONValueTransformer __JSONObjectFromMyInnerModel:] not found

How can i fix it to run with unit testing ?

Upvotes: 0

Views: 1103

Answers (1)

Lena Bru
Lena Bru

Reputation: 13947

Need to make sure that the sources are not added twice in the build phases of the test target compile sources

https://stackoverflow.com/a/26658739/2136812

Upvotes: 2

Related Questions