I have a real problem with XCode (15 and 16) which is that all the time it'll get stuck installing/attaching to an app.
It'll be working fine one minute, I can make a code change, build, and run the app (on hardware) and everything will be fine. But then make another change, build and run again and now XCode will get stuck saying "Installing app to phone" / "Attaching to app on phone".
If I click stop and try and run again now there'll be two "Installing app to phone" instances running, do it again and then there'll be three and so on.
If I quit XCode and relaunch it then it does not fix the issue, I have to terminate XCode and reboot the phone. And then it'll be ok again, but only for about 10 minutes, but then it'll start doing the exact same thing again. Its impossible to work like this, having to reboot the phone every 10 minutes or so. Is there any solution or tricks? (is it possible to kill the hung task within XCode for example?)
Something that has worked for me is to right click on the device in the devices and simulators screen and select unpair device. It should immediately start pairing and the phone prompt you to trust the computer. It might be worth unplugging and plugging it back into your mac first, if this doesn't work.