When I charge my iPhone 4 on my laptop, it starts charging but then it keeps going on and off charging even though it's not touched. It charges fine with a plug charger or with any computers I use at college.
Running this in terminal worked for me: (it will ask for your user's password)
sudo killall -STOP -c usbd
This pauses the troublesome process instead of killing it altogether like other answers suggest. The difference is that macOS won't try to reopen it automatically and cause the issue again.
sudo killall -CONT usbd will resume the process, should anything require it.
Tested on: iPhone 7 (iOS 11) + MacBook Pro Late 2013 (10.13.6)
Besides software issues, there's a good chance that the cable is at least partially damaged so it might work for dumb power chargers but not with a MacBook that also relies on the USB data pins.
You probably have a buildup of lint/debris in the phone's charger (lightning) port. Use a plastic or wood toothpic to gently scrape inside the port. Do not use a paper clip, or any other metal obeject! I had the same issue with a two year old iphone 6 and retreived enough lint to knit a sweater. It charges without interuption now.
I purchased a Lifeproof Fre Power case for iPhone 6s (Feb 2016). You must use a micro USB cable to charge the case, not a Lightning cable. I had the same problem as Aamir Ali. Drove me nuts.
But you are right. Use a powerful charger and the "ON/OFF" charging problem goes away. Same cable at home didn't work with cigar lighter charger in truck/auto, even though it is a 5.4 Amp Belkin model. Or so they state.
When powered through top-quality and high amp chargers the problem goes away. The cable type or model does not seem to matter. Only the power source.
Lifeproof has been "nice", but has no good technical answer for this problem. "You must use our cable and charger." Hmm.
This happened to me with iPhone 5c. The way I charged was under a stack of books (6 or so). We went to the Apple Store to see if we could get it fixed but they said that getting it fixed would cost more than the actual phone. So I ended up just getting a whole new phone. But if you don't want to do that then like I said you could charge it under a stack of book with one on the bottom
I have found a solution to this problem (I was also struggling with this for a while). It's basically because the macbook is trying to create a data connection with the iphone through the usb port. Here are some things that seems to work in my case:
- Using a USB extender and then connecting the iphone to it.
- Or Force quitting itunes and then plugging in the iphone.
- Or Ejecting the iphone from the itunes.
I have come to understand that it is not a problem due to the cable, nor due to a broken USB port (so stop changing that). Just stop the data connection process between the iphone and mac using the above 3 ways or any other way you find. Let me know if it works.