I used to have the same problem. Turns out connecter #4 will not stay put, keeps popping off. I had to put on several layers of thick tape on top of the connector so that closing the iPhone kept the connector in place. You may have to add more tape if the iPhone still doesn't charge. My iPhone has been working for several months with no reoccurence of the charging problem.
I know this is an old thread, but, just in case somebody is having this problem today and is searching for any answers, my 3GS had this problem but no more. Basically I narrowed it down to the electrical outlet being used. I didn't believe it at first but after trying different outlets in my house the same thing happened. So try different outlets. I suspect some outlets have more electrical noise than others thus confusing the IPhone. Even try an outlet at somebody elses house.
When I replaced my battery, connector #4 would not stay fully seated, so the battery wouldn't charge. I had to put a number of thick tape on top of that connector so that closing the Iphone would put pressure on the connector. So far for six months it has been working.
Sometimes when my 3GS won't charge, I do a Reset where I hold down both the HOME and POWER button until the Apple symbol appears. If this doesn't work, then it could be the Dock connector. I noticed on my iPhone that when I plug in the charger cable, the connection is very loose, i.e. I can wiggle the cable connector up and down. When I hold the connector in the down position, the iPhone would start charging, but not when the connector is in the up position. So that is how I have been charging my iPhone for the last two months. Keeping it in the down position with some weight on the cable. Hope it works for you.
Had same problem as yours. If you can open your Iphone, open it very slightly, no need to disconnect any cables. Look thru the opening and you will see two prongs extending from the Home button. Use a Q-Tip and clean both tips with a cleaner such as those that are used to clean LCD screens. Also clean the two pads on the circuit board where the two prongs contact, this is important. Did this several months ago and my Home button still works.
For those who are having a non-responsive HOME button, I got my working by cleaning the two pads that the two fingers sit on. I used the cleaning fluids for LCD screens. You have to open the Iphone slightly using the method posted here on Ifixit but you don't have to disconnect any cables.
I was getting the same error message you are seeing. I tried different chargers and new cables but no joy. The error message went away when I used a 2100 ma charger (Apple clone) and a short charger cable. Don't use the six feet long Apple cable. The charger cable I am using is made by Duracell, Model # ES8086-DU. The cable does not have the two data pins, only the two voltage pins and it is only 2 feet long. Iphone charging only works with the 2100 ma charger. You cannot charge an Iphone from a computer since it only has 500 ma maximum output. Just now I charged a dead Iphone showing the red battery warning to full power in only three hours.
I had the same issue as you. I thought cable 2 was OK but it kept popping off. I finally concluded I wasn't applying enough pressure. Once I did it stayed connected. I'm assuming you have the cable correctly aligned. Check that before applying more pressure. Good Luck.
I had the same symptoms as you are having. A replacement battery solved my problem. At power up, the battery screen showed 1/3 charged, so you may have a bad battery or you may need a new dock connector. Also make sure connector #4 is securely connected. I had to put some tape on the top to make sure the connector stayed down.
When removing the display assembly with the suction cup, put some duct tape on the Iphone where the Sim card tray is. This prevents destroying the internal cables if the display assembly comes off too fast. Also it helps to hold the display assembly at 45 degrees, so you can remove cables #1, 2, and 3.
Make sure when you are re-assembling, that the cables snap in, you can feel it happen. Some of my cables were hanging loose when I re-open the Iphone to troubleshoot why it wasn't working the first time.
I put on a piece of duct tape on the Iphone where the Sim tray is. Keeps the display assembly in place preventing cable damage.
When removing the display assembly with the suction cup, put some duct tape on the Iphone where the Sim card tray is. This prevents destroying the internal cables if the display assembly comes off too fast. Also it helps to hold the display assembly at 45 degrees, so you can remove cables #1, 2, and 3.
Make sure when you are re-assembling, that the cables snap in, you can feel it happen. Some of my cables were hanging loose when I re-open the Iphone to troubleshoot why it wasn't working the first time.