Xcode 13.2.1 Preview Not Working but Simulator Works

Viewed 3227

My Xcode Version 13.2.1 (13C100) got an unknown issue. I did several things like delete Xcode, new install Xcode, restore from backup nothing make any change! Currently, the project can be built and run in the simulator, but not in the preview window! it gives a message:

Cannot preview in this file - Timed out waiting for connection to DTServiceHub after 15.0 seconds.

What is the issue here any idea? iMac becomes very slow when I taped the resume button. Please Help!

enter image description here

6 Answers

I had a similar problem and was solved when I turned of Automatically refresh canvas

enter image description here

Suddenly It fixed, maybe the last update from apple through a software update called "Command Line Tools for Xcode". Before I have also tried a fresh OSX installation but the issue has not gone at all.

Check Software Update from system preference.


Thanks to the great community.

Try the following:

  1. Clicking on the "Diagnostics" button on the failed preview pane.

  2. Copy the ".pcm" file path. It looks like something similar to "/var/folders/aa/xxxxxxxxxxxxxxxxxxxxxxx/C/clang/ModuleCache/12345ABCDE/MyTest-XXXXXXXXXXXXXX.pcm"

  3. Run the following command to remove the .pcm file in the Terminal app (replace the path using the specific path you copied from the Diagnostics log obtained in the step above:

    rm -rf /var/folders/aa/xxxxxxxxxxxxxxxxxxxxxxx/C/clang/ModuleCache/12345ABCDE/MyTest-XXXXXXXXXXXXXX.pcm

References:

  1. https://support.macincloud.com/support/solutions/articles/8000098646
  2. https://developer.apple.com/forums/thread/696908

screenshot

on a Mac with apple silicon chip

  1. CTRL + Click on Xcode app
  2. Get info
  3. Check "open using Rosetta"

I had the same problem:

No preview with diagnostic : "Cannot preview in this file - Timed out waiting for connection to DTServiceHub after 15.0 seconds".

Tried the solutions found on the internet, without success.

I switched to macOS beta 12.3 and Xcode 13.2. And now there is the preview...

The below solution has worked for me:

Running a preview for a project having scenedelegate or appdelegate which worked and then i tried running preview for app protocol style project which was not working earlier.

Related