0

我在文件中有一个相当简单的JSONModel.h

@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

.m文件中

@implementation MyModel @end
@implementation MyInnerModel @end

然后我在http请求中得到一些json并做

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

这在正常运行时完美运行。

但是当我尝试在单元测试期间运行它时,我得到以下信息:

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

我怎样才能修复它以运行单元测试?

4

1 回答 1

2

需要确保在测试目标编译源的构建阶段没有添加两次源

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

于 2014-10-30T16:51:09.377 回答