I have been struggled with this issue for years. When connect my iPad to my Macbook Pro, it connected and disconnected then connected and disconnected.... This make me crazy sometime. Today I decided to research for a solution.
After googling, I found this thread https://www.ifixit.com/Answers/View/473839/iOS+devices+connecting+and+disconnecting+rapidly.
Below are some methods I tried.
- Unplug the power, then shut down your Mac. - Hold the left Shift+Control+Option keys down, then press and hold the power button down. Keep all four buttons pressed down for ten seconds, then let go. - Plug the power cable back in, then turn on your Mac.
Settings > General > Reset > Reset Location & Privacy
Open terminal, run this
sudo killall usbd
If not work, try this
sudo killall -STOP -c usbd
And lucky me. My iPad can connect with my Macbook Pro after running
sudo killall -STOP -c usbd and now I can debug using my iPad.
If you got this issue, please try then let me know which one works for you.