gpt4 book ai didi

ios - 使用未声明的类型 'XCTestCaseEntry'

转载 作者:可可西里 更新时间:2023-11-01 01:57:24 24 4
gpt4 key购买 nike

嗨,我似乎无法弄清楚为什么我是 Use of undeclared type 'XCTestCaseEntry'

在我的 .xctest 中使用以下代码时:

import XCTest

#if !os(macOS)
public func allTests() -> [XCTestCaseEntry] {
return [
testCase(TrakkproTests.allTests),
]
}
#endif

最佳答案

我在尝试为使用 Swift 包管理器构建的自定义框架运行单元测试时遇到了同样的问题。

原来我不小心在Xcode方案/设备选择器中选择了一个iOS模拟器:

enter image description here

这编译了满足 !os(macOS) 编译条件的 iOS 代码,导致错误发生。 XCTestCaseEntry 似乎是 swift-corelibs-xctest 的一部分为非 Apple 平台(即 linux)提供 XCTest 功能的项目,但与 Apple 使用的实现不同......我认为。

我的解决方案是在方案/设备选择器中选择“我的 Mac”:

enter image description here

关于ios - 使用未声明的类型 'XCTestCaseEntry',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50886854/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com