swift - UITest 失败并出现错误 'ld: entry point (_main) undefined. for architecture x86_64'

标签 swift xcode xcode-ui-testing

我是 Xcode 和 Swift 的新手。我只是尝试使用 swift 语言创建 UITest。当我尝试运行仅打印“Hello world”的简单测试时,我发现此构建失败并出现错误::

"ld: entry point (_main) undefined. for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)"

有人遇到同样的问题吗?如果您能分享修复方法,我将不胜感激。顺便说一句,我正在使用 Xcode 9.1 和 Swift 4

最佳答案

修复步骤:

  1. 选择您的项目
  2. 转到目标 -> 选择您的测试目标
  3. 然后转到 Build Setting -> Search Mach-O Type
  4. 更改为 -> Bundle

enter image description here

关于swift - UITest 失败并出现错误 'ld: entry point (_main) undefined. for architecture x86_64',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49202360/

相关文章:

iOS 动画故障,Y 坐标问题

xcode - 任何恶意软件都可以访问 OSX 钥匙串(keychain)数据吗

ios - 将 imageView、图像和背景图像保存到相机胶卷?

ios - 如何设置状态栏白色 ios 7.1?

ios - 从 UITest 中选择 Collection View 中的第一个单元格

ios - Xcode UI 测试 - 通过 id 在 Webview 中查找元素

ios - 切换单元格的UITableView

ios - 如何快速更改现有通知的用户信息?需要维护用户登录记录

swift - 查找数组中每个对象的属性总和

ios - 如何从 XCode UI 测试覆盖率报告中排除第三方 Pod 库