gpt4 book ai didi

ios - Xcode 6 测试目标 : Unidentified Symbols for Architecture

转载 作者:行者123 更新时间:2023-11-28 20:55:00 26 4
gpt4 key购买 nike

我正在运行 Xcode 6.1.1。我使用以下方法设置了一个新的测试目标:File > New > Target

使用空模板运行测试工作正常。我导入了一个 header ServerController,并尝试创建一个实例:

#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

现在运行测试给我这个:

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)

最佳答案

对于在您的应用程序中查找类的链接器错误...在您的应用程序目标中将“默认隐藏的符号”build设置设置为“否”。这使您的所有应用程序类自动可用于您的测试目标......所以,这意味着:

项目导航器 > 选择您的项目

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

build设置> 搜索“默认隐藏的符号”

“默认隐藏的符号”> 将其从"is"更改为“否”

检查来源:answer

关于ios - Xcode 6 测试目标 : Unidentified Symbols for Architecture,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27928462/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com