ios - 构建 Xcode UITest 失败并显示 `error opening input file`

标签 ios xcode xcode-ui-testing

我向我现有的 Xcode 项目添加了一个 UITest 目标。

录制 UITest 效果很好。 但是在构建期间运行相同的记录 UITest 失败并出现错误:

Compile Swift source files
Precompile bridging header
<unknown>:0: error: error opening input file '/Users/<...>/Bridging-Header.h' (No such file or directory)

路径正确,路径下有文件

  • 尝试将文件添加到目标,但我无法将其添加到任何目标,因为复选框显示为灰色。
  • 尝试清理构建文件夹并删除派生数据文件夹,同样的问题。

有什么想法吗?

最佳答案

解决方案是更改Bridging Header 文件的路径。

  1. 选择测试目标,例如MyAppUITests
  2. 导航到 Build Settings > Swift Compiler - General > Objective-C Bridging Header
  3. 替换头文件的现有路径,例如MyApp/MyApp-Bridging-Header.h./MyApp/MyApp-Bridging-Header.h。添加 . 将允许测试目标找到头文件。

关于ios - 构建 Xcode UITest 失败并显示 `error opening input file`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49208938/

相关文章:

xcode - 在 map 上选择一个位置会给出错误的坐标

ios - XCUIApplication().debugDescription 的打印输出使 UIAutomated Test XCode 8 崩溃

ios - 如何在 iOS 中使用 Swift 和 Core 蓝牙从 Polar H10 获取心率测量值?

ios - xcodebuild 无法使用 XCTestExpectation 运行异步测试?

ios - Firebase iOS -.queryOrdered().queryEqual(toValue : and child(). observeSingleEvent 之间有什么区别

iphone - Xcode 错误 : Incompatible Objective-C types. 预期为 'struct UIView'

ios - 在 Jenkins 上运行 Xcode UI 测试永远不会失败

ios - 如何将我的 App 模块导入 MyAppUITests 文件?

ios - UIBarButtonItem setTintColor white 但在真实手机中运行时它变为灰色

objective-c - 使用 [__NSArrayM objectAtIndex :]: index 0 beyond bounds for empty array error 崩溃