Prevent iPhone charger from capturing audio
For a solution that doesn't require jailbreaking and modifying your phone's OS, I would suggest a USB charge-only dongle, like this one or this.

Insert that on the USB end of your cable, and it will only connect the charging pins, not the data pins, preventing any audio or other data from transferring.