- 在单元测试的 Target -> General 勾选 Allow testing Host Application APIs
- 在 Podfile 中添加 Quick 和 Nimble
- 在 Podfile 中使用 use_frameworks! 或者 use_modular_headers! (单独指定:modular_headers => true也可以)
忘记勾选 Allow testing Host Application APIs,在 import 第三方库的时候会报以下错误:
Undefined symbols for architecture x86_64:
"ObjectMapper.<- infix<A>(inout A, ObjectMapper.Map) -> ()", referenced from:
DDBaseKitModule_Tests.TestModel.mapping(map: ObjectMapper.Map) -> () in DDModelTypeSpec.o
"ObjectMapper.<- infix<A>(inout A?, ObjectMapper.Map) -> ()", referenced from:
DDBaseKitModule_Tests.TestModel.mapping(map: ObjectMapper.Map) -> () in DDModelTypeSpec.o
"(extension in DDBaseKitModule):Swift.Dictionary< where A == Swift.String>.queryStringParameters() -> Swift.String", referenced from:
closure #1 () -> () in closure #1 () -> () in DDBaseKitModule_Tests.ExtensionSpec.spec() -> () in ExtensionSpec.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)