Xcode 12 Beta - Cannot find simulator runtime

為{幸葍}努か 提交于 2020-12-29 03:51:36

问题


I have installed Xcode 12 beta 2. I tried to run our xamarin project through Jenkins on Mac OS Catalina. It fails with the below error. When I build the same project from Mac Visual studio, it succeeded without any error.

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,_

I also did xcrun simctl list to view the available runtime simulators for Xcode 12 beta. It shows the below list but fails while building.

== Runtimes ==

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

== Devices ==

When I opened Xcode Settings and clicked to Components -> Simulator I do not see iOS 14 in the list:

Can anyone help me to resolve this?


回答1:


I have a similar problem building with Xcode 12 beta on Jenkins. When I run xcrun simctl list in Terminal with jenkins user, I see

== 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

But if I put the same simctl command to be executed by a Jenkins job, the result is

== 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)

Although I could not find a solution, I found a workaround. If I stop Jenkins from running as a launch daemon and start it manually from the Terminal, then Xcode beta builds run fine.

# 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

All of the above paths are the default ones. If yours happen to be different, you may find the correct values in the file /Library/LaunchDaemons/org.jenkins-ci.plist




回答2:


This command can fix the issue:

sudo xcrun simctl shutdown all && sudo xcrun simctl erase all

And I found it here: https://developer.apple.com/forums/thread/653807




回答3:


I am seeing this issue on Xcode 12.1 using the default install of Jenkins. None of these solutions work, and the "manual run of the sh script" results in Jenkins not even being able to load at all.

I am using a build command against a device (not a simulator) that looks like this:

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

This command runs fine when I run it from the command prompt of my regular admin console user, but not from Jenkins.

Jenkins is installed normally under its own /users/Shared/Jenkins account.

Also, I see that in the Xcode 12.2 release notes (I am on 12.1) there is still a "known issue" that says Simulators may not be available when running command-line tools like simctl or xcodebuild from a non-root LaunchDaemon, or when launching as a different user from the current user (for example, with sudo or launchctl). (62188195) - https://developer.apple.com/documentation/xcode-release-notes/xcode-12_2-beta-release-notes

The issue seems to exist on the devices as well as the simulators.

UPDATE The solution is to reinstall Jenkins using homebrew under your regular user, have them auto-login, then use a LaunchAgent attached to that user to start jenkins when your user logs in.

Jenkins no longer supports being installed using the "jenkins user" and running as a LaunchDaemon, and neither does Xcode.



来源:https://stackoverflow.com/questions/62875323/xcode-12-beta-cannot-find-simulator-runtime

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!