The latest addition to Xcode's long list of bugs is the problem of Simulator screen going black and getting stuck. We need to manually kill the simulator and rebuild the project. This gets really frustrating if your project has significant build time.
You may follow following steps as a workaround till Apple fixes the issue in upcoming Xcode releases.
- Download the above script file.
- Give the script file execute permission. You can either use Finder or run
chmod +x <path-of-the-script>
from the terminal to make it an executable file. - Go to Xcode -> Behaviours -> Edit behaviours.
- Go to Starts under the Build section. Scroll down to Run option. Enable it and choose the downloaded script path.