Ios 使用KIF访问另一个目标中的类

Ios 使用KIF访问另一个目标中的类,ios,testing,kif,Ios,Testing,Kif,我有一个动态改变行数的pickerView。我想从主应用程序目标中的模型中选择此计数 比如说,, //测试目标 #import <KIF/KIF.h> #import "SearchModel.h" //import class from main target @interface Acceptance_Tests : KIFTestCase @property (nonatomic, strong) SearchModel * searchModel; @end @impl

我有一个动态改变行数的pickerView。我想从主应用程序目标中的模型中选择此计数

比如说,, //测试目标

#import <KIF/KIF.h>
#import "SearchModel.h" //import class from main target

@interface Acceptance_Tests : KIFTestCase
@property (nonatomic, strong) SearchModel * searchModel;

@end

@implementation Acceptance_Tests

-(void)test_01_SearchWithConditions
{
    self.searchModel = [[SearchModel alloc] init];

    [tester tapViewWithAccessibilityLabel:@"Search Library"];
    [tester tapViewWithAccessibilityLabel:@"type_pickerView"];

    //choose type
    for(int i = 0; i < self.searchModel.types.count; i++)
    {
        [tester waitForTappableViewWithAccessibilityLabel:@"Search"];
        [tester selectPickerViewRowWithTitle:[self.searchModel.types objectAtIndex:i]];
        [tester tapViewWithAccessibilityLabel:@"Search"];
    }
}
我还可以将SearchModel.m添加到测试目标中的编译库中,但这意味着我必须添加所有类两次(在主目标和测试目标中),mm。 有什么想法吗?我可以通过另一种方式访问主目标中的类吗
?编译错误告诉您出了什么问题。您正在x64模式下运行KIF测试(在build_设置中检查您的体系结构和有效的体系结构。您的目标应用程序可能没有相同的体系结构设置


首先,我要确保KIF测试目标和应用程序之间的架构设置是相同的。

测试、KIF测试也作为正在测试的主机应用程序的一部分捆绑在一起。确保项目“构建设置”中“链接”下的“捆绑加载程序”和“测试”下的“测试主机”都设置为应用程序二进制文件。如果您已将KIF目标创建为“iOS单元测试包”,则默认情况下应进行设置。

SearchModel的类型是动态的还是静态的?请尝试检查文件关联。确保文件包含在目标中。@kpsharp,也许你不明白我的问题,这个变体不适用于我,因为这句话没有任何意义。这对我没有帮助。我理解你的问题,我想你不理解我的答案。
 Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_SearchModel", referenced from:
      objc-class-ref in Acceptance_Tests.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)