iPhone 5 charging sound keep repeating, why? I am using my iPhone 5 for iOS development so it is attached to computer via cable and often when I hold it and rotate it to see screen in a different orientation and I accidentally touch the cable at the neck, Xcode warns me about lost connection, and the lightning sign disappear from iPhone screen on the top right corner and I can hear this irritation charging sound.

What can be the problem? The screen is a little bit scratched.

If I would replace screen would it solve the problem?

I have bought and tested with a brand new Apple cable.
I brought iPhone back to Apple Service and the guy cleaned my iPhone at the plug with the needle that you can open the sim card tray. So he cleaned it, and that was lots of dirty coming out. And after all I have to claim connection is much more stable. So you should clean it first.