ios - 单元测试未编译 - Swift Xcode 9.2

标签 ios swift xcode testing tdd

我正在学习一些 Swift 的 TDD,我遇到了 Xcode 无法编译我的测试代码的问题。我不知道这可能有什么问题。

其他测试工作正常(也测试“ListItem”和“Location”)。我还关闭了 Xcode 多次并清除了 Derived Data 甚至项目本身。

下面是代码截图和编译错误。如果我将方法中的“ListItem”参数更改为“Any”(并且还更改数组的类型),它正在编译。但这不是我想要的没有特定类型的代码。

谢谢!

enter image description here

enter image description here

最佳答案

在这里找到解决方案: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/

相关文章:

ios - 如何从给定的包 ID 中获取 Apple App ID?

ios - Xcode 7.3 智能感知根本不起作用

swift - 在 Plist 中检索用户定义的值

iOS UILabel 大小问题

swift - “Collection”要求类型 'MyCollectionClass.Element' 和 'Slice< MyCollectionClass>' 等效

swift - 如何在swift 4中交叉点击单元格按钮

ios - Xcode 错误 - 由于未捕获的异常 'NSUnknownKeyException' 导致应用程序终止,原因 : '[ setValue:forUndefinedKey:]:

ios - 动画 UIProgressview 颜色变化

android - 创建安装应用程序并仅运行该应用程序的代码

ios - 将 CGPoints (CIRectangleFeature) 从 Image 转换为 ImageView