Luckily, there a couple of not-so-expensive options.
The adapter provides MIDI in, out, and thru using the standard MIDI interface.
This makes it an excellent choice compared to other solutions.

If you could’t keep your iPad charged, your playing time will be limited.
iRig MIDI 2 also works with all generations of the iPad or iPhone.
This helps the iPad recognize your unit.
This solution is great for those simply trying to create a simple MIDI connection.
The Connection Kit is available for iPads that have a Lightning connector and older iPads with the 30-pin connector.