Preview Canvas does not work

My Preview Canvas does not work anymore.

I already uninstalled and freshly reinstalled Xcode (App Store Version and direct download from developer.apple.com, version 13.2 with Big Sur and now updated to Monterey 12.1). I uninstalled Xcode using AppCleaner and also by clearing the clang/cache folders, as well as Lib/Dev... etc. manually, but the same error comes up over and over again.

When I run the code directly (via Run/Simulator instead of Preview/Canvas) the app shows up and works just fine.

I open Xcode, I create a new project for iOS, I resume the preview and it fails with the attached error...

Any help would be greatly appreciated as at the moment, I don't have a running development environment unfortunately...

Thanks in advance.

Best regards Silvio

  • Same problem here.

  • I had that error for a while and removing the cache helped but then I got a new error:

    MessageSendFailure: Message send failure for update

    ==================================

    |  RemoteHumanReadableError: The operation couldn’t be completed. XPC error received on message reply handler

    |  

    |  BSServiceConnectionErrorDomain (3):

    |  ==NSLocalizedFailureReason: XPC error received on message reply handler

    |  ==BSErrorCodeDescription: OperationFailed

  • It seems my error is only occurring with the SwiftUI view has an @FocusState variable.

Add a Comment

Accepted Reply

This fixed it for me:

  1. Finder > Go to folder "/var/folders/kv/t_w2wdds3m1_0lr02hcp3dgw0000gn/C/clang/ModuleCache/12TRQXIDQ8QQD/"
  2. Remove "SwiftShims-2TTN5UXQBRCCQ.pcm" (I kept a copy on my desktop just in case)
  3. Run a build in the simulator
  4. Preview now works (for me at least)

Hope this works for you.

  • Hi @seamount Thanks a lot! It worked for me as well. :-)

  • Man you are a life saver @seamount . This was driving me up the wall.

  • Boom! Excellent tip, @seamount! Can't thank you enough. Have spent hours searching for a solution. What a relief. Thanks again!

Replies

This fixed it for me:

  1. Finder > Go to folder "/var/folders/kv/t_w2wdds3m1_0lr02hcp3dgw0000gn/C/clang/ModuleCache/12TRQXIDQ8QQD/"
  2. Remove "SwiftShims-2TTN5UXQBRCCQ.pcm" (I kept a copy on my desktop just in case)
  3. Run a build in the simulator
  4. Preview now works (for me at least)

Hope this works for you.

  • Hi @seamount Thanks a lot! It worked for me as well. :-)

  • Man you are a life saver @seamount . This was driving me up the wall.

  • Boom! Excellent tip, @seamount! Can't thank you enough. Have spent hours searching for a solution. What a relief. Thanks again!

Also using 13.2.1 helps ... but that version then has other issues.

  • I don't think so - I got this issue right after I updated to 13.2.1, didn't have it on 13.2 (although 13.2 didn't work properly with apps made in Playgrounds 4).

Add a Comment

Sometimes Commmand + Shift + K, which is clean also works. It solved it for me. Worth mentioning

Thanks, I was encountering the same error from the recent upgrade, and COMMAND + SHIFT + K restored my preview.