我正在尝试使用此代码导入我的类
import XCTest
@testable import Test2
class Tests_iOS: XCTestCase {
var test2:TestModule2!
override func setUp() {
let test2 = TestModule2()
}
}
Run Code Online (Sandbox Code Playgroud)
但是 xcode 抛出未定义的符号错误
Undefined symbol: nominal type descriptor for Test2.TestModule2
Undefined symbol: type metadata accessor for Test2.TestModule2
Undefined symbol: Test2.TestModule2.__allocating_init() -> Test2.TestModule2
Run Code Online (Sandbox Code Playgroud)
我使用 UIKit 的旧 xcode 11 代码不会发生这种情况。
这个错误的原因是什么以及如何正确导入模块。
系统规格
Mac M1 16GB
OS: Big Sur 11.4
Xcode: Version 13.0 beta (13A5154h)
Run Code Online (Sandbox Code Playgroud)
如果您创建了一个多平台项目,则默认测试目标是 UI 测试而不是单元测试。尝试添加单元测试类型的新测试目标。请参阅此答案:https ://developer.apple.com/forums/thread/665120
| 归档时间: |
|
| 查看次数: |
1468 次 |
| 最近记录: |