clang: error: linker command failed with exit code 1 (use -v to see invocation) when doing unit test on xcode
clang: error: linker command failed with exit code 1 (use -v to see invocation) when doing unit test on xcode
我在 xcode 上进行单元测试时遇到此错误。我尝试导入 "SignIn.h" 并测试 SignIn.h/SignIn.m.
中定义的 VerifyEmail class
我的代码如下:
#import <XCTest/XCTest.h>
#import "SignIn.h"
@interface SignInTests : XCTestCase
@property (nonatomic) VerifyEmail* verifyEmail;
@end
@implementation SignInTests
- (void)testVerifyEmail
{
_verifyEmail = [[VerifyEmail alloc] init];
}
...
我只是遵循通常的单元测试流程。 import "SignIn.h" and @属性 (nonatomic) VerifyEmail* verifyEmail 没问题,但是当我尝试初始化 verifyEmail (_verifyEmail = [[VerifyEmail alloc] init];) 时出现如下错误:
ld: warning: directory not found for option '-Llibs/Debug-iphonesimulator'
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_VerifyEmail", referenced from:
objc-class-ref in SignInTests.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
我已经为此工作了很长时间,真的需要有人帮忙。谢谢!
尝试向现有 iOS 项目添加单元测试时,有时需要将主应用程序目标的构建设置中的 "Symbols Hidden by Default" 设置为否。
检查此 post:http://twobitlabs.com/2011/06/adding-ocunit-to-an-existing-ios-project-with-xcode-4/
它仍然适用于 xcode 7。谢谢托德!
我在 xcode 上进行单元测试时遇到此错误。我尝试导入 "SignIn.h" 并测试 SignIn.h/SignIn.m.
中定义的 VerifyEmail class我的代码如下:
#import <XCTest/XCTest.h>
#import "SignIn.h"
@interface SignInTests : XCTestCase
@property (nonatomic) VerifyEmail* verifyEmail;
@end
@implementation SignInTests
- (void)testVerifyEmail
{
_verifyEmail = [[VerifyEmail alloc] init];
}
...
我只是遵循通常的单元测试流程。 import "SignIn.h" and @属性 (nonatomic) VerifyEmail* verifyEmail 没问题,但是当我尝试初始化 verifyEmail (_verifyEmail = [[VerifyEmail alloc] init];) 时出现如下错误:
ld: warning: directory not found for option '-Llibs/Debug-iphonesimulator'
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_VerifyEmail", referenced from:
objc-class-ref in SignInTests.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
我已经为此工作了很长时间,真的需要有人帮忙。谢谢!
尝试向现有 iOS 项目添加单元测试时,有时需要将主应用程序目标的构建设置中的 "Symbols Hidden by Default" 设置为否。 检查此 post:http://twobitlabs.com/2011/06/adding-ocunit-to-an-existing-ios-project-with-xcode-4/
它仍然适用于 xcode 7。谢谢托德!