7

I installed the Xcode-11-beta along with macOS 10.15 beta. At first I can play with SwiftUI preview normally. But after I tried to move the Xcode-beta from the ~/Downloads directory where I initially installed it, to /Applications, the preview can't work. Here is the error:

enter image description here

So I moved it back to ~/Downloads, hoping things will go well as before. But it gives the same error.

After this, I reinstalled it and I still got this error. Can anyone help me fix it?

The content of diagnostics report is this:

== 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
wzso
  • 3,482
  • 5
  • 27
  • 48

3 Answers3

28

CoreSimulator does not currently like simruntime bundles being moved out from under it. By launching from ~/Downloads it became aware of the iOS.simruntime for iOS 13, then you moved it.

In this one specific case you can workaround the problem by killing com.apple.CoreSimulator.CoreSimulatorService.

russbishop
  • 16,587
  • 7
  • 61
  • 74
  • Ran into this too and killing `CoreSimulatorService` solved it for me. This should be the accepted answer. A full restart is unnecessary. – Steven Peterson Sep 21 '19 at 04:34
  • Absolute statements like this are neither helpful nor, more importantly, particularly accurate. I am pleased that killing the `CoreSimultorService` worked for you. It did not for me. Nor did a full restart. Instead I found that the advice in the following post worked. If anything, given the vastly different set-ups on all our "machines" your comment shows up the flaw (fatal imo) in the very notion of an "accepted answer". Perhaps it is time for a discussion as the validity of this idea itself? Post: https://stackoverflow.com/questions/57388536/no-ios-13-simulator-in-xcode-11-beta-5 – Joseph Beuys' Mum Sep 30 '19 at 09:28
  • 5
    killall com.apple.CoreSimulator.CoreSimulatorService was the command that worked for me. – Gene Z. Ragan Nov 07 '19 at 01:15
17

Weird thing is I wake up in the morning and start my computer, the Canvas and the iOS 13.0 Simulator can work now.

So, I guess the solution to this may be just a brutal restart. ;]

wzso
  • 3,482
  • 5
  • 27
  • 48
3

The XCode 11 upgrade breaks simulators in a weird way that I don't fully understand - nothing I tried would work to get simulators to run after the upgrade, and I couldn't find much in the way of clear answers as to why that was the case, but the following two commands fixed the issue for me:

  • sudo xcrun simctl shutdown all
  • sudo xcrun simctl erase all
gifpb
  • 31
  • 1
  • Hi.. I'm on Xcode 11.3 now and need to use an older 10.3.1 sim. I have created it using: $ xcrun simctl create "iPhone 6" "iPhone 6" iOS10.3.1 14E8301 37FAE547-CB68-4B76-81A3-8E748CC590B1. The simulator now exists and I confirm the runtime is installed using: xcrun simctl list devicetypes runtimes which shows iOS 10.3 (10.3.1 - 14E8301) - com.apple.CoreSimulator.SimRuntime.iOS-10-3 however I cannot get the new simulator to appear in the runtime destination list so I cannot select it to run my project. Did you encounter this? – imobilizer Jan 09 '20 at 15:58