You should take a very gentle approach to cleaning your iPhone's charging port. The safest method is to use a dry, soft-bristled brush or anti-static brush to gently remove dust inside the port. You can also use compressed air (light bursts only), but don't spray canned air too close. Never use metal pins or water — as this can damage the phone. If the charging problem keeps recurring, it's best to have a professional cleaning done at an Apple Store.