iPhone constantly disconnecting while working in Xcode
I think this is not the problem with the device/Mac port/USB cable.
This seems to be an issue with usbd
in Mac OS. The following can solve the issues:
Open Activity Monitor -> View -> All Processes -> Search for usbd
-> Double click -> Quit -> Force Quit
Using terminal:
sudo killall -STOP -c usbd
will pause the issue related process
If you want to resume the process for any reason use the following command
sudo killall -CONT usbd
This solution is working in MacOS Catalina as well.
In the end removing expired certificates (current ones were already installed) solved the problem.