xcode 无法确定 xxxTest TEST_HOST 的包标识符
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/39848098/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Could not determine bundle identifier for xxxTest TEST_HOST
提问by BennX
We do have troubles getting our CI to work with Xcode. We encounter the issue Could not determine bundle identifier for xxxTest TEST_HOST: some path that does not exist
.
我们确实很难让我们的 CI 与 Xcode 一起工作。我们遇到了这个问题Could not determine bundle identifier for xxxTest TEST_HOST: some path that does not exist
。
What we have done so far:
到目前为止我们所做的:
- On the CI Machine we are able to run all tests on the device, but if we trigger it with a commit the CI does end in that error.
- We had that issue on other machines too, when we tried to run the tests of the application. We fixed that by cleaning the machine and reboot the devices.(Had do fix some scheme settings) Not we can run all tests but we run into the issue sometimes without any reason.
- We also double checked the schemes. The Host Application is set in every Tests scheme to the App itself.
- 在 CI 机器上,我们能够在设备上运行所有测试,但是如果我们通过提交触发它,CI 会以该错误结束。
- 当我们尝试运行应用程序的测试时,我们在其他机器上也遇到了这个问题。我们通过清洁机器并重新启动设备来解决这个问题。(必须修复一些方案设置)我们不能运行所有测试,但有时我们会无缘无故地遇到问题。
- 我们还仔细检查了计划。主机应用程序在每个测试方案中都设置为应用程序本身。
Our project has the following targets:
我们的项目有以下目标:
- App
- App Unit Tests
- App UI Tests
- AppeareanceKit (Module)
- AppeareanceKit Unit Tests
- Models (Module)
- Models Unit Test
- 应用程序
- 应用单元测试
- 应用界面测试
- 外观套件(模块)
- AppearanceKit 单元测试
- 模型(模块)
- 模型单元测试
Found solution:
找到解决方案:
- Diabling the Tests except the App UITest
- Run the tests once
- Enable all Tests
- Run the tests
- 禁用除 App UITest 之外的测试
- 运行一次测试
- 启用所有测试
- 运行测试
Question:
题:
- What is happening there? How can we prevent from having that issue over and over again?
- 那里发生了什么?我们怎样才能防止这个问题一遍又一遍地出现?
Known questions:
已知问题:
Xcode 8 Beta - Convert to Current Swift Syntax Failed: Could not find test host
Xcode 8 Beta - 转换为当前 Swift 语法失败:找不到测试主机
回答by BennX
So after ages of having this issue, we could find the right checkbox to fix this issue.
因此,在遇到此问题多年之后,我们可以找到正确的复选框来解决此问题。
It somehow sounds weird but the issue was the configurations for the command-line builds inside of the Project settings.
这听起来很奇怪,但问题是项目设置中命令行构建的配置。
I assume this happens because we always test against the debug configuration and it was set to release. Therefore it did the wrong build for the test host.
我认为发生这种情况是因为我们总是针对调试配置进行测试,并将其设置为发布。因此它为测试主机做了错误的构建。
This does set the defaultConfigurationName
inside of the {projectname}.xcodeproject
.
这确实设置defaultConfigurationName
了{projectname}.xcodeproject
.
Please comment if you have any more insights of this.
如果您对此有更多见解,请发表评论。
回答by Giuseppe Lanza
In my app I found a solution.
在我的应用程序中,我找到了一个解决方案。
The problem was of course in the test target.
问题当然出在测试目标上。
I hope that this solution will work for you too. Go to your test target build settings.
我希望这个解决方案也适用于你。转到您的测试目标构建设置。
Search for test host.
搜索测试主机。
In my case this testHost was looking like
在我的情况下,这个 testHost 看起来像
build/{buildConfigurationName}-iphoneos/{schemeName}.app/{appName}
Which is wrong as the actual path must be
这是错误的,因为实际路径必须是
build/{buildConfigurationName}-iphoneos/{schemeName}.app/{schemeName}
so if you have a build configuration called Alpha, in your app named MyApp, with a scheme called MyApp-Alpha the test host path should be
因此,如果您有一个名为 Alpha 的构建配置,在名为 MyApp 的应用程序中,使用名为 MyApp-Alpha 的方案,则测试主机路径应为
build/Alpha-iphoneos/MyApp-Alpha.app/MyApp-Alpha
it was
它是
build/Alpha-iphoneos/MyApp-Alpha.app/MyApp
I hope this can help... unfortunately this issue appears in many cases.
我希望这可以帮助...不幸的是,这个问题在很多情况下都会出现。
回答by Jacobo Koenig
One reason to have this error is that your info.plist of your target is not in its path. So if you moved it or removed the reference to it, you may get this error.
出现此错误的原因之一是您的目标的 info.plist 不在其路径中。因此,如果您移动它或删除对它的引用,您可能会收到此错误。
So if you moved it, put it back into its place or path. if you removed the reference to it, add it again, close and reopen the project.
因此,如果您移动了它,请将其放回原位或路径。如果您删除了对它的引用,请再次添加,关闭并重新打开项目。