UITest:架构 armv7 的未定义符号

UITest: Undefined symbols for architecture armv7

我正在尝试从我的 UITest 目标调用 swift 单例。我正在导入主模块:@testable import Ary 但是当我尝试构建它时说:

Undefined symbols for architecture armv7:
  "Ary.DataModelLayerOperation.getter : Ary.DataModelLayer", referenced from:
      AryUITests.AryUITests.setUp (AryUITests.AryUITests)() -> () in AryUITests.o

d: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

虽然语法高亮显示有效(单例没有访问修饰符,因此它被标记为内部,这对于从测试目标访问应该是完美的)...

我调用的函数是[在 XCTestCase 中]:

 override func setUp() {
    super.setUp()
  if !DataModelLayerOperation.isUserLoggedIn() {
    //do something
  }
}

恐怕你想要实现的目前是不可能的。我遇到了类似的问题并提出了我的问题here。我很快就会接受这样的答案:

The UI tests are a separate module from the app, therefore not run inside your app as a logic test would.

我希望在接下来的 Xcode 版本中会有所改进。