Destroy MIDIUMPMutableEndpoint again?

Is there a way to destroy MIDIUMPMutableEndpoint again?

In my app, the user has a setting to enable and disable MIDI 2.0. If MIDI 2.0 should not be supported (or if iOS version < 18), it creates a virtual destination and a virtual source. And if MIDI 2.0 should be enabled, it instead creates a MIDIUMPMutableEndpoint, which itself creates the virtual destination and source automatically.

So here is my problem: I didn't find any way to destroy the MIDIUMPMutableEndpoint again. There is a method to disable it (setEnabled:NO), but that doesn't destroy or hide the virtual destination and source. So when the user turns MIDI 2.0 support off, I will have two virtual destinations and sources, and cannot get rid of the 2.0 ones.

What is the correct way to get rid of the MIDIUMPMutableEndpoint once it is created?

Destroy MIDIUMPMutableEndpoint again?
 
 
Q