When I connect my iPhone to my MacBook to charge it, a sound is played on the iPhone, the green battery symbol appears instead of the clock, the small battery symbol the upper right corner turns green and a flash symbol appears next to it. Then it goes back to normal: the small battery turns white, the flash disappears and the the big battery symbol vanishes in favor of the clock.
And then it starts over. The charging sound is played about once per second. Charging, not charging, charging, not charging...
After a while it settles, but this can take a long time. Even when it started charging quietly, it might fall back into the pattern described. When the lid of the MacBook is closed, it isn't as bad. Connecting the MacBook to power doesn't make a difference.
This does not happen, when I charge the iPhone with a wall plug or a battery pack. Only when I connect it to my MacBook. The USB ports are fine I think, I don't have any issues with other peripherals.
Its an iPhone 6s with iOS 12.1.2 and a MacBook Air 2014 with Mojave. I also have an Android phone which charges slowly, but steadily on my MacBook.
I suspect the MacBook or MacOS to be at fault here. It seems like the charging protocol can't agree on something and they try again and again and again...
I would like my iPhone to play the charging sound once when I connect it to my MacBook and then charge quietly.
Sometimes my MacBook wants to install a software update when I connect the iPhone, but it always fails to do so.