Creating charging switch on iPhone charger I am attempting to create a switch on my iPhone charging wire so that I can use my device to test iOS applications I'm creating on my Mac without actually charging the device. When I'm working on an app my devices are often charged to 100% and have to be kept charging while I'm working, often for days on end.

So, in an effort to preserve my devices battery, I've split open one of my old iPhone chargers, and after looking up the USB wiring diagram put a toggle switch on the red +5V wire. (not the D+ or D- wires or ground)

Now, the switch works just fine, but the problem is that when the switch is in the off state, not only does the iPhone stop charging (as it should) but the computer also detects that the device has been disconnected, which isn't very useful to me.

Anybody have any thoughts on what could be done to make this work? I'm more of a software guy so I'm not all that familiar with what hardware wise would need to be modified to make this work. Or better yet, if theres anything that can be changed programmatically to make my Mac detect a device that isn't charing that would be awesome! Thanks for any input on this!
There are these devices, but I'm not sure where you'll find one now. You could also use a non-powered USB hub.

But in all honesty, iPhone lithium ion batteries won't be too damaged by continual charging, it's not like to old days of NiCad (Nickel Cadmium) batteries.