我正在学习一些 Swift 的 TDD,我遇到了 Xcode 无法编译我的测试代码的问题。我不知道这可能有什么问题。
其他测试工作正常(也测试“ListItem”和“Location”)。我还关闭了 Xcode 多次并清除了 Derived Data 甚至项目本身。
下面是代码截图和编译错误。如果我将方法中的“ListItem”参数更改为“Any”(并且还更改数组的类型),它正在编译。但这不是我想要的没有特定类型的代码。
谢谢!
最佳答案
在这里找到解决方案:swift Xcode unit test: Cannot convert value of type "Person" to expected argument type "Person"
似乎 ItemManager .swift 文件没有添加到项目的测试目标 (derp)..
关于ios - 单元测试未编译 - Swift Xcode 9.2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47989608/