我安装了 Xcode-11-beta 和 macOS 10.15 beta。一开始我可以正常玩
SwiftUI preview
。但是当我尝试将 Xcode-beta 从最初安装的 ~/Downloads
目录移动到 /Applications
时,预览无法工作。错误如下:
所以我把它移回
~/Downloads
,希望事情能像以前一样顺利。但它给出了同样的错误。
此后,我重新安装了它,但仍然出现此错误。谁能帮我解决一下吗?
诊断报告内容是这样的:
== DATE:
Wednesday, June 5, 2019 at 10:25:46 PM China Standard Time
== PENDING U
PDATE REASONS:
== PREVIEW UPDATE ERROR:
unexpected error occurred
Error Domain=com.apple.CoreSimulator.SimError Code=161 "The iOS 13.0 simulator runtime is not available." UserInfo={NSLocalizedRecoverySuggestion=Download the iOS 13.0 simulator runtime from the Components section in Xcode's Preferences., NSLocalizedFailureReason=runtime path not found, NSLocalizedDescription=The iOS 13.0 simulator runtime is not available.}
== VERSION INFO:
Tools: 11M336w
OS: 19A471t
== ENVIRONMENT:
[x] In valid workspace
[x] Project is using the new build system
Previews are available for targets that are built with the new build system. Change your project to use the new build system.
[x] Selected scheme (Landmarks)
Select a scheme from the scheme picker in the toolbar
[x] Selected run destination (iPhone 8)
Select a run destination from the scheme picker in the toolbar
[x] Have workspace arena
Try quitting and reopening your workspace
[x] Have build arena
Try quitting and reopening your workspace
[x] Open file has supported build settings
CoreSimulator 目前不喜欢将
simruntime
包从其下方移出。通过从 ~/Downloads
启动,它意识到了 iOS 13 的 iOS.simruntime
,然后你移动了它。
在这种特定情况下,您可以通过杀死
com.apple.CoreSimulator.CoreSimulatorService
来解决该问题。
奇怪的是,我早上醒来,启动电脑,
Canvas
和iOS 13.0 Simulator
现在可以工作了。
所以,我想解决这个问题的办法可能只是残酷的重启。 ;]
XCode 11 升级以一种我不完全理解的奇怪方式破坏了模拟器 - 我尝试过的任何方法都无法让模拟器在升级后运行,而且我找不到太多明确的答案来解释为什么 情况确实如此,但以下两个命令为我解决了这个问题:
sudo xcrun simctl shutdown all
sudo xcrun simctl erase all
通过以下命令修复
sudo killall -9 com.apple.CoreSimulator.CoreSimulatorService