1. Try the other original charging cable for your iPhone iPad.
2. Clean your Apple Accessory. You can use a pushpin to carefully insert it into your iPhone or iPad charging port, and clean out the pocket lint or debris from the charging port.
3. Plug your charger in, when you get the error message hold your finger on the dismiss button and pull your charger out. While still applying pressure to the screen, plug your charger back in and it should work.
4. Turn off the device with the Lightning plug attached and then restart it.
5. Connect your iPhone to the charging cable. The error message will appear, so dismiss or ignore it. Next, turn on the Airplane mode in your device. Turn off your iPhone and wait for 1 minute and turn it on again.