'xctrace sometimes hangs on "Waiting for device to boot"

Sometimes when I run xctrace, e.g. xcrun xctrace record --template Zombies --device <my udid> --launch -- 'MyApp', it just prints out "Waiting for device to boot" and then times out 30 seconds later. Does anyone know why this might be happening, or if there are any mitigations for it?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source