Failure of AudioUnitSetProperty when using MacCatalyst (works on macOS)

I was trying to set custom audio output device for a generated audio on macCatalyst.

While using let status = AudioUnitSetProperty(outputUnit, kAudioOutputUnitProperty_CurrentDevice, kAudioUnitScope_Global, 0, &outputDeviceID, UInt32(MemoryLayout.size))

kAudioOutputUnitProperty_CurrentDevice is invalid, and status = -10879, indicating an error.

STEPS TO REPRODUCE

  1. Set Run Destination to MacOS and run the program. "AudioUnitSetProperty: 0" should be printed, indicating it works fine.
  2. Set Run Destination to Mac Catalyst and run the program. "Error setting output device: -10879" should be printed, indicating an error.
Failure of AudioUnitSetProperty when using MacCatalyst (works on macOS)
 
 
Q