gpt4 book ai didi

ios - 无法通过 Jenkins 上的 xcodebuild 从命令行执行测试

转载 作者:可可西里 更新时间:2023-11-01 03:59:08 24 4
gpt4 key购买 nike

我正在使用以下命令来执行测试:

xcodebuild test -workspace MyApp.xcworkspace -scheme MyScheme -destination 'platform=iOS Simulator,name=iPhone 6,OS=8.1'

这在本地工作得很好,但是当我在 Jenkins 上尝试这个时,它会失败并出现以下错误:

xcodebuild test -workspace MyApp.xcworkspace -scheme MyScheme -destination 'platform=iOS Simulator,name=iPhone 6,OS=8.1'

xcodebuild: error: Unable to find a destination matching the provided destination specifier: { platform:iOS Simulator, OS:8.1, name:iPhone 6 }

The requested device could not be found because no available devices matched the request.

Available destinations for the "MyScheme" scheme:

Build step 'Execute shell' marked build as failure

Finished: FAILURE

所以我在 Jenkins 上启动了 Xcode GUI 来检查 iPhone 6 模拟器是否存在,它就在那里。另一个有趣的事情是,当我在本地运行相同的 xcodebuild 命令而不指定目标的名称和操作系统时,我会得到所有可用模拟器的列表,如下所示:

Available destinations for the "MyScheme" scheme: { platform:iOS Simulator, id:683233C4-EC2B-48A3-826B-10EF62A875CD, OS:8.1, name:iPad 2 } { platform:iOS Simulator, id:6358A6F5-2FD0-4377-BD32-0A2C3329276D, OS:8.1, name:iPad Air } { platform:iOS Simulator, id:224533ED-94DA-46CC-B1DB-1781A1C80710, OS:8.1, name:iPad Retina } { platform:iOS Simulator, id:D114BC7E-A913-4063-A349-C119BAFC06DA, OS:8.1, name:iPhone 4s } { platform:iOS Simulator, id:7AF6D6F4-C6BC-4A47-B83C-3A4B43ABE0DD, OS:8.1, name:iPhone 5 } { platform:iOS Simulator, id:BE82D607-466A-43E5-863D-6A05F217C117, OS:8.1, name:iPhone 5s } { platform:iOS Simulator, id:0AFCC9AB-7C59-48C7-9BFB-FBF4865B7A63, OS:8.1, name:iPhone 6 Plus } { platform:iOS Simulator, id:D183FF05-3023-4FB5-BEA0-290EA881040A, OS:8.1, name:iPhone 6 } { platform:iOS Simulator, id:26038DBD-791C-421E-99F4-9153CA726A2F, OS:8.1, name:Resizable iPad } { platform:iOS Simulator, id:31B2F0AE-3547-4189-A561-CD2088F6C645, OS:8.1, name:Resizable iPhone }

但是当我在 Jenkins 上做同样的事情时,这个列表是空的。

我在本地和 Jenkins 上都使用 Xcode 版本 6.1 (6A1052d),我的方案已正确共享,因此当我在 Jenkins 上启动它时,我可以在 GUI 中看到它们。我不确定它是否相关,但我正在使用工作区清理插件,并且在构建 Jenkins 之前删除了所有派生数据。

编辑:我发现当使用 generic/ 预先设置目标值时,我在 Jenkins 上得到了正确的模拟器列表,它仍然提示我找不到要运行的模拟器,即使我使用的是在名单上:

xcodebuild test -workspace MyApp.xcworkspace -scheme MyScheme -destination 'generic/platform=iOS Simulator,name=iPhone 6,OS=8.1'

xcodebuild: error: Unable to find a destination matching the provided destination specifier: { platform:iOS Simulator, OS:8.1, name:iPhone 6 }

The requested device could not be found because no available devices matched the request.

Available destinations for the "MyScheme" scheme: { platform:iOS Simulator, id:20D0A659-A25A-40E1-9C11-FC6ECA004012, OS:8.1, name:iPad 2 } { platform:iOS Simulator, id:7B5DF104-BE34-415F-8818-3907B6CB9C63, OS:8.1, name:iPad Air } { platform:iOS Simulator, id:2DDF024E-811D-4D93-BD8E-EF34BFC9D8CA, OS:8.1, name:iPad Retina } { platform:iOS Simulator, id:FFE95D35-B9DD-449E-83D0-50777BF5B783, OS:8.1, name:iPhone 4s } { platform:iOS Simulator, id:EF5A0D8A-6A1F-492C-B451-8F3B8B5EC5EE, OS:8.1, name:iPhone 5 } { platform:iOS Simulator, id:A1FCF8DA-BD9F-4ABC-8E0A-4B8547362274, OS:8.1, name:iPhone 5s } { platform:iOS Simulator, id:1B75E350-7FC8-4407-8116-F3674F3AC187, OS:8.1, name:iPhone 6 Plus } { platform:iOS Simulator, id:694CAA87-765D-4FDF-8B27-75E5B537F48E, OS:8.1, name:iPhone 6 } { platform:iOS Simulator, id:FF5588C0-14B5-4303-A2AC-9ACF63B1852C, OS:8.1, name:Resizable iPad } { platform:iOS Simulator, id:E402C9C9-97BA-4909-96B3-3D3C7F6CCC3B, OS:8.1, name:Resizable iPhone }

Build step 'Execute shell' marked build as failure

Finished: FAILURE

最佳答案

原来 Jenkins 使用的用户没有足够的权限。当我创建另一个工作并尝试签署文件时,我想通了。默认情况下,Jenkins 使用“jenkins”用户来做事,但如果你与其他用户 ssh 或屏幕共享到你的构建服务器,那么你就完蛋了。我决定删除我的 Jenkins 守护进程,改为使用 JenkinsApp .

关于ios - 无法通过 Jenkins 上的 xcodebuild 从命令行执行测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26863302/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com