The latest iPhones are able to charge wirelessly, which will help cut down on this issue. It’s also worth keeping your charging cables clean. Periodically check the contacts for signs of gunk or wear.
What to Use to Clean Your Lightning Port
If your iPhone charging port is filthy, you can clean it yourself. You don’t need special cleaning kits, nor do you need compressed air. Despite many tutorials online recommending it, Apple tells customers to not use compressed air or aerosol sprays of any kind when cleaning their iPhones.
This is likely due to the high pressure at which air escapes from the can. This pressure could damage the iPhone internally. It could also jeopardize the water-resistant assembly on newer iPhone models. Fortunately for the task at hand (removing dried on and sticky gunk) compressed air isn’t much use anyway.
I once had a problem with my iPhone 5s refusing to charge. It was still under AppleCare warranty, so I took it to Apple for investigation. The Genius who addressed the issue solved it by cleaning out a lot of gunk from the charging port.
For this task the technician used a plain old iPhone SIM key, which is normally used to release the SIM tray.
Since then, I’ve had no trouble using a SIM key to clean my iPhone. I’ve applied a fair amount of force to the SIM key while scraping out the port, and never damaged it. The Genius who cleaned my old iPhone was careful but thorough.
If you’d rather use something a little less metallic, a thin toothpick or wooden skewer will do the job just fine. You could use a paper clip or another thin pin, but always take a little more care when using a sharp metal object for this task.