ios - Xcode 中的测试不会因运行时错误而执行
问题描述
每次我尝试在任何项目上运行测试时,都会遇到一个奇怪的运行时错误。我将此功能添加到一个全新的项目(delete_me)
func easyAdd(x: Int, y: Int) -> Int {
return x + y
}
和这个测试
import
@testable import delete_me
...
func test_easyAdd() {
...
let sum: Int = easyAdd(x: 20, y: 30)
XCTAssertEqual(sum, 50)
}
我得到一个运行时错误,Undefined symbol: delete_me.easyAdd(x: Swift.Int, y: Swift.Int) -> Swift.Int
还有一点调试错误是
Undefined symbols for architecture x86_64: "delete_me.easyAdd(x: Swift.Int, y: Swift.Int) -> Swift.Int", referenced from: Tests_iOS.Tests_iOS.test_easyAdd() -> () in Tests_iOS.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
我觉得这必须是关于我的 Xcode 是如何安装的,或者一些缺少的工具,或者一些工具安装在错误的位置,但我不确定如何解决这个问题。
解决方案
推荐阅读
- android - 如果用户添加新项目,自动完成 Textview 会更新建议列表
- bash - 如何在 bash 脚本内的新终端中调用函数?
- linux - 我如何打开 eve-ng wizzard 设置
- c# - Windows 窗体按钮的按钮文本中的彩色字母表
- advanced-custom-fields - 在同一页面上的灵活内容块中调用 ACF 灵活内容块
- javascript - 内容安全政策指令不适用于电子
- dapper - Dapper GetList vs Query Method 具有不同的性能
- python - 如何在 Python 中组合列表和字典?
- windows - docker volume create 中的此平台错误不支持如何解决选项
- python - Discord PY 没有获取用户头像