'iPhone constantly disconnecting while working in Xcode
I've been developing an app for a while and I haven't had any problems running the app on the device.. now a few days ago, whenever I connect the iPhone, it plays its little "ka-chink" sound and shows up in Xcode, but after a few seconds it disconnects and reconnects with another "la-chink" and keeps doing this until I want to throw it out of the window.
Of course, it's not possible to debug on the device with the constant disconnections, so I just:
- connect the device
- run the app on the device
- app crashes
- I remove the cable
- restart the app and it runs fine
I've tried various thing to get the phone to work properly again but to no avail so far.. anybody experienced this? any solutions?
Update: cable and connector fine, no hardware trouble.
Solution 1:[1]
In the end removing expired certificates (current ones were already installed) solved the problem.
Solution 2:[2]
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.
Solution 3:[3]
The only thing that worked for me (tried many things) was to reset Location and Privacy settings on the iPhone:
Settings -> General -> Reset -> Reset Location & Privacy
As of iOS 15, this setting is in:
Settings -> General -> Transfer or Reset iPhone -> Reset -> Reset Location & Privacy
Solution 4:[4]
If the problem appeared after Big Sur update, don't worry! This issue has occurred in the past, after major macOS updates, or when users attempt to connect an iPhone for the first time to a new Mac computer. Fortunately, there is a permanent working fix that you can apply using a special command in the Terminal app.
Connect your device
Open terminal
Copy/paste the following command in the Terminal window:
sudo killall -STOP -c usbd
Thats all! Hope it will help!
Solution 5:[5]
Changing the port that connected to cable is worked for me.
Solution 6:[6]
Try to remove and reactivate your phone from the devUsage in the organizer
Solution 7:[7]
Note: this may not be a permanent fix. Starting having the error again after 8 hours of no problems.
I just had this problem (devices would connect, then randomly disconnect any time while using Xcode, or not even doing anything, sometimes they would reconnect but after a while I had to completely restart the computer). I fixed it by essentially resetting the "trust this computer" for all of the devices registered to my Mac. I am unsure how I may have gotten my computer to this state; I did change the "name" of my computer in Terminal and that may have done it.
Thanks to this site for pointing me in the right direction: http://andyaffleck.com/2014/11/07/fixing-trust-this-computer-problem/
In /var/db/lockdown
there are plist files. I couldn't get access into the folder from the Finder, but using sudo
in terminal let me list the files, and I could delete them with sudo rm
, one at a time. Somehow the plist files were corrupt or incorrect.
Then after a restart, when I plugged in my phones again, the trust?
dialog showed up on the phone, I accepted, and now I have not had a disconnection.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Frank R. |
Solution 2 | |
Solution 3 | |
Solution 4 | Dan Dolog |
Solution 5 | trkclk |
Solution 6 | |
Solution 7 |