Chosen Solution

Hi My iphone is only charging when it’s switched of… I think it’s a hardware problem because i deleted everything on the Iphone and recovered. Sometimes its charging while its on, but most of the time its only charging whend it’s switched of… So i can’t sync with itunes. Can you help me? Which part of the Iphone could be broken?

Best and most likely solution is to replace the charging dock. Sometimes cleaning the charger port in result has actually made it worse because the pins in the charging dock have already been damaged or worn out. Any alignment issues can make the connection to the charging cable worse easily. You can get the part from here: iPhone 4S Dock Connector You can replace the part yourself if you want using this guide: iPhone 4S Dock Connector Replacement