iOS 13.0 模拟器运行时不可用

The iOS 13.0 simulator runtime is not available

我安装了 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

奇怪的是我早上醒来并启动我的电脑,CanvasiOS 13.0 Simulator 现在可以工作了。

所以,我想解决这个问题的方法可能只是残酷的重启。 ;]

CoreSimulator 目前不喜欢 simruntime 包从它下面移出。通过从 ~/Downloads 启动,它意识到 iOS.simruntime 为 iOS 13,然后你移动了它。

在这种特殊情况下,您可以通过终止 com.apple.CoreSimulator.CoreSimulatorService.

来解决问题

XCode 11 升级以一种我不完全理解的奇怪方式破坏了模拟器 - 我尝试的任何方法都无法在升级后使模拟器达到 运行,但我做不到关于 为什么 是这种情况,找到很多明确的答案,但以下两个命令为我解决了这个问题:

  • sudo xcrun simctl shutdown all
  • sudo xcrun simctl erase all