Software-related troubleshooting solutions
If the hardware seems fine, the problem might be related to the software. Here are a few steps to address potential software glitches.
Restart your iPhone
A simple restart can resolve minor software glitches that might affect charging. To restart your iPhone X or later model, hold down the volume-up button and the sleep/wake (or action) button simultaneously. Wait for the power-off slider to appear, and slide to power down. To restart, hold the same buttons until the Apple logo appears.
To restart your iPhone 6, 7, 8, or SE (2nd or 3rd generation), hold down the power button only. When the slider appears, slide to power off. Wait 30 seconds, then turn it back on by holding the side button again until you see the Apple logo.
For an iPhone SE (1st generation), 5, or earlier, press and hold the top button. Wait for the slider to appear, then slide to power off. Wait 30 seconds, then hold down the top button until the Apple logo appears.
If the above steps don’t work, you can force restart your iPhone.
Update iOS
Outdated software can sometimes cause charging problems. To check for and install any available iOS updates, go to Settings > General > Software Update. If an update is available, your device will prompt you to update your phone. Download and install the new update, which might fix any software-related charging problems.