首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Xcode6测试目标:架构的未知符号

Xcode6测试目标:架构的未知符号
EN

Stack Overflow用户
提问于 2015-01-14 01:58:17
回答 1查看 301关注 0票数 1

我运行的是Xcode 6.1.1。我设置了一个新的测试目标: File > new > target

使用空模板运行测试可以很好地工作。我导入了一个头文件ServerController,并尝试创建一个实例:

代码语言:javascript
复制
#import <UIKit/UIKit.h>
#import <XCTest/XCTest.h>
#import "ServerController.h"

@interface Tixie_Tests : XCTestCase

@end

@implementation Tixie_Tests

- (void)setUp {
    [super setUp];
    // Put setup code here. This method is called before the invocation of each test method in the class.
    ServerController * s = [[ServerController alloc] init];
}

- (void)tearDown {
    // Put teardown code here. This method is called after the invocation of each test method in the class.
    [super tearDown];
}

- (void)testExample {
    // This is an example of a functional test case.
    XCTAssert(YES, @"Pass");
}

- (void)testPerformanceExample {
    // This is an example of a performance test case.
    [self measureBlock:^{
        // Put the code you want to measure the time of here.
    }];
}

@end

现在运行测试得到以下结果:

代码语言:javascript
复制
Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_ServerController", referenced from:
      objc-class-ref in <omitted>.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
EN

回答 1

Stack Overflow用户

发布于 2015-09-09 12:53:12

对于在应用程序中查找类时出现的链接器错误...在应用程序目标中将“Symbols Hidden by Default”构建设置设置为“NO”。这将使您的所有应用程序类自动可用于测试目标...所以,这意味着:

项目导航器>选择项目

目标>选择您的应用程序(不是测试)

构建设置>搜索"Symbols Hidden Default“

"Symbols默认隐藏“>将其从"YES”更改为"NO“

查看源站:answer

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27928462

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档