You may see an error message on your phone’s screen when you connect an accessory which is generally supported by the device and you may have even used it earlier without any problems. This error message may suggest that the accessory is not optimized for the iPhone even though it has worked without problems before.
Solution 1: Clean the connector
Most of the times, a dirty or obstructed connector is the reason for this problem. Check for dirt in the connector and clean it with a piece of cotton cloth. Try it again and you should be able to connect the accessory without any errors.
Solution 2: Clean the logic board
Alternatively, the logic board may be dirty which can be causing a similar problem. Remove the logic board and gently clean the contacts to make sure that dirt may not be obstructing the connection.