Xcode compilation error: failed to initiate service connection to simulator

Failed to initiate service connection to simulator Error returned in reply: connection invalid

opened xcode and ran successfully. Then click on the simulator and there was no response. Reruns this prompt box and clear the cache.
solution: you need to close all the different versions of xcode and the emulator, and just reopen and run.
because multiple versions of xcode are open running

Read More: