This issue appears when you try to connect your iPhone to charger cable, then the phone vibrates and you get a message saying “the accessory may not be certified” or something similar. Even if you try to use a different cable, you may get the same error message. Here is what you can do to get this issue resolved.
Use a small pin to clean the charging port. Removing the debris and dust may help to fix the issue. Make sure that you use the original Apple cable and keep in mind the iPhone 6 and iPhone 6 Plus may require a different power supply.
Plug the charger in. When you get the error message, press firmly and keep your finger on the dismiss button. Then pull the charger out. Keep applying pressure on the iPhone screen and then plug the charger back.
Another option that you can try is to enable Airplane more. First connect your iPhone to the charging cable. Once the error message appears, ignore it and activate Airplane mode on your iPhone. Then switch off the iPhone and allow 2 minutes or so before switching it on. You should not get the error message anymore.