Xcode 12 Beta - 找不到模拟器运行环境

11

我已经安装了 Xcode 12 beta 2。我试图通过 Jenkins 在 Mac OS Catalina 上运行我们的 xamarin 项目,但是它在以下错误处失败了。当我从 Mac Visual Studio 构建同样的项目时,它成功了而没有任何错误。

SplashViewController.storyboard : error :
 iOS 14.0 (14.0 - 18A5319g) - com.apple.CoreSimulator.SimRuntime.iOS-14-0 (unavailable, failed to open liblaunchsim.dylib) ==> not available:
  Error Domain=com.apple.CoreSimulator.SimError Code=401 "The iOS 14.0 simulator runtime is not available."
  UserInfo={NSLocalizedDescription=The iOS 14.0 simulator runtime is not available.,
   NSUnderlyingError=0x7fef8847b520 {Error Domain=NSPOSIXErrorDomain Code=53 "Software caused connection abort"
  UserInfo={NSLocalizedFailureReason=XPC error talking to SimLaunchHostService: <error: 0x7fff97d649a0> { count = 1, transaction: 0, voucher = 0x0,_

我也通过xcrun simctl list命令来查看Xcode 12 beta可用的模拟器运行时。下面的列表显示可用的运行时,但在构建过程中却失败了。

== 运行时 ==

iOS 14.0 (14.0 - 18A5319g) -
com.apple.CoreSimulator.SimRuntime.iOS-14-0
tvOS 14.0 (14.0 - 18J5331g) -
com.apple.CoreSimulator.SimRuntime.tvOS-14-0
watchOS 7.0 (7.0 - 18R5327h) -
com.apple.CoreSimulator.SimRuntime.watchOS-7-0

== 设备 ==

当我打开 Xcode 设置并点击 组件 -> 模拟器 时,我在列表中没有看到 iOS 14

有人可以帮我解决这个问题吗?


尝试重新添加模拟器? - user12867493
3
尝试添加模拟器,但这并没有帮助。 - Priya22
3个回答

4

我在 Jenkins 上使用 Xcode 12 beta 进行构建时,遇到了类似的问题。当我使用 Jenkins 用户在终端中运行 xcrun simctl list 命令时,会看到以下输出:

== Runtimes ==
iOS 14.0 (14.0 - 18A5351d) - com.apple.CoreSimulator.SimRuntime.iOS-14-0
tvOS 14.0 (14.0 - 18J5364d) - com.apple.CoreSimulator.SimRuntime.tvOS-14-0
watchOS 7.0 (7.0 - 18R5361c) - com.apple.CoreSimulator.SimRuntime.watchOS-7-0

但是如果我将相同的simctl命令放在Jenkins作业中执行,结果就会是:

== Runtimes ==
iOS 14.0 (14.0 - 18A5351d) - com.apple.CoreSimulator.SimRuntime.iOS-14-0 (unavailable, failed to open liblaunch_sim.dylib)
tvOS 14.0 (14.0 - 18J5364d) - com.apple.CoreSimulator.SimRuntime.tvOS-14-0 (unavailable, failed to open liblaunch_sim.dylib)
watchOS 7.0 (7.0 - 18R5361c) - com.apple.CoreSimulator.SimRuntime.watchOS-7-0 (unavailable, failed to open liblaunch_sim.dylib)

虽然我没有找到解决方案,但我找到了一种解决方法。如果我停止Jenkins作为启动守护程序运行,并从终端手动启动它,那么Xcode测试版就可以正常运行。

# Stop Jenkins
sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist

# Impersonate jenkins user
sudo su - jenkins

# Tell Jenkins where its home dir is located
export JENKINS_HOME=/Users/Shared/Jenkins/Home

# Start Jenkins instance
/Library/Application\ Support/Jenkins/jenkins-runner.sh

以上所有路径都是默认路径。如果你的路径与默认路径不同,你可以在文件 /Library/LaunchDaemons/org.jenkins-ci.plist 中找到正确值。


非常感谢这个解决方法。它修复了我的问题。 - Priya22
我在 Xcode 12 GM Seed 1 中遇到了相同的问题。这是唯一解决它的方法。我们实际上正在 LaunchAgents 中运行 Jenkins,但这并没有帮助。 - Mark Thormann
jenkins-runner.sh 是什么? - dmlebron
@dmlerbon,jenkins-runner.sh 是在 macOS 上启动 Jenkins 的脚本,请参见 https://wiki.jenkins.io/display/JENKINS/Thanks+for+using+OSX+Installer - Vladimir Grigorov
这个脚本只有在作为代理而非守护进程运行时才会使用吗? - dmlebron

3

2

我在使用默认安装的Jenkins时,遇到了在Xcode 12.1上出现的问题。这些解决方案都没有起作用,而“手动运行sh脚本”会导致Jenkins无法加载。

我正在针对一个设备(而不是模拟器)使用以下构建命令:

/usr/bin/xcodebuild -scheme MyApp -workspace MyApp.xcworkspace -configuration Debug clean build DEVELOPMENT_TEAM=XXXXXXXXXX -allowProvisioningUpdates test -destination platform=iOS,id=theIDofADeviceNotASimulator

这个命令在我的常规管理员控制台用户的命令提示符中运行正常,但在Jenkins上却不行。

Jenkins通常安装在其自己的/users/Shared/Jenkins账户下。

此外,我注意到在Xcode 12.2版本说明中(我使用的是12.1),仍存在一个“已知问题”,即当从非root LaunchDaemon运行命令行工具(如simctl或xcodebuild)或以不同于当前用户的用户身份启动时(例如通过sudo或launchctl),模拟器可能无法使用。 (62188195) - https://developer.apple.com/documentation/xcode-release-notes/xcode-12_2-beta-release-notes

这个问题似乎在设备和模拟器上都存在。

更新 解决方法是使用homebrew在您的常规用户下重新安装Jenkins,让它们自动登录,然后使用附加到该用户的LaunchAgent在用户登录时启动jenkins。

Jenkins不再支持使用“jenkins用户”进行安装,并作为LaunchDaemon运行,Xcode也一样。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接