I was having the “TimeoutError: Timed out waiting for connection to DTServiceHub after 15.0 seconds.” Often. Have searched online for a solution but could find. How ever, I have done the following and have solved. After that, I have a hypothesis why it happened:
- I use OneDrive. I turned it on and waited it to completely sync the files
- I had created a new single file, with the initial “Hello, world!”. Don’t change anything! The preview wont work yet.
- Run the application like it is ready. Wait the iPhone simulator initialize for complete, and the app shows the “Hello, world!”.
- Close the app on simulator
- Close the simulator
- Close the Xcode
- Restart the Mac
It should work!
In my case I was re-thinking what have I done since the last time the Xcode´s Preview was working. Turns out I have tried to run the app simulation on simulator and it was taking too long and I just closed the simulator without it has been completely on. My hypothesis is that, closing it down wrongly maybe had messed up with some Xcode configurations and when I turned on and off correctly this time it has been fixed.
Now I can use my previews normally!
Hope it helps!