尝试在私有pod上运行测试时出错

时间:2018-03-21 12:57:17

标签: swift xcode xctest

我正在处理一些内部pod,以便在我们的开发过程中使用。 这是我以前做过很多次的事情,从来没有出过过问题。

最近,我在尝试运行XCTests时遇到错误。

2018-03-21 12:43:22.054233+0000 xctest[63996:2843446] The bundle “<pod>_Tests” couldn’t be loaded because it is damaged or missing necessary resources. 

Try reinstalling the bundle.

2018-03-21 12:43:22.054394+0000 xctest[63996:2843446] (dlopen_preflight(/Users/<#username>/Library/Developer/Xcode/DerivedData/<#pod>-fbsbcldvjowbzzajxgzamhshhusv/Build/Products/Debug-iphonesimulator/<#pod>_Tests.xctest/<#pod>_Tests): 
Library not loaded: @rpath/<#pod>.framework/<#pod>
Referenced from: /Users/<#username>/Library/Developer/Xcode/DerivedData/<#pod>-fbsbcldvjowbzzajxgzamhshhusv/Build/Products/Debug-iphonesimulator/<#pod>_Tests.xctest/<#pod>_Tests
Reason: image not found)

Program ended with exit code: 82

我应该注意:

  1. 如果我在测试应用中使用相同的代码,它会完美运行。
  2. 如果我在不使用任何对pod类的引用的情况下构建测试,它就会完美运行。
  3. 无法弄清问题是什么。在线查看并找到了一些关于UTests的答案,但这些答案并没有多大帮助。

    使用最新的Xcode(9.2)和最新的swift(4.0.3)。

    有什么想法吗?

1 个答案:

答案 0 :(得分:0)

我通过设置测试目标的主机应用程序解决了这个问题。从导航器中选择项目,在 TARGETS 部分下选择您的测试目标并设置主机应用程序,

相关问题