Mac Catalyst: AVAudioSession.availableInputs does not return inputs

Hi,


I am trying to port audio input to Mac Catalyst. As of now I am using xcode11.1GMseed, macOS 10.15 Beta 10 and (ios13 release).


The following code does not return any input ports under catalyst, it works however on iOS deivces. I have granted the "Hardend Runtime - Audio Input" entitlement and also the catalyst app asks for microphone permission which is granted then of course. So it is not a permission problem.


let audioSession = AVAudioSession.sharedInstance()
try audioSession.setActive(true, options: .notifyOthersOnDeactivation)

var mic : AVAudioSessionPortDescription? = nil
for input in audioSession.availableInputs! {
  if input.portType == AVAudioSession.Port.builtInMic {
    mic = input
  } else {
    print("Not internal mic")
}


// ERROR !!! here: 'mic' is nil, but it should at least find builtInMic


When accessing audioSession.availableInputs the following error show up in the console:


2019-10-02 08:20:18.005998+0200 [3340:162455] [avas] AVAudioSession_MacOS.mm:258:-[AVAudioSession getChannelsFromAU:PortName:PortID:]: ERROR in getting channel layout for auScope 1768845428 element 1

2019-10-02 08:20:18.006890+0200 [3340:162455] [avas] AVAudioSession_MacOS.mm:351:-[AVAudioSession createPortsfromAggregateDevice:]: No Ports available returning empty



Is this a bug due to beta status of the whole stuff or am I missing something ? We are now in 10.15. beta 10 which is probably near release ...


Thanks

Chris

Replies

Anybody who can contribute to this ? I need a solution !!!

Did you find any solution for this? I am having the exact same error while trying to record something in my Mac Catalyst app.

Everything works as expected (with the same code) on both the iPhone and iPad apps, but not on the Mac.
Blind shot: Do you have microphone access permission?
@Maven: Yes of course
@ivancnatorino: No, apple engineers were committed but didn't offer a solution

As of 2021-03 the bug seems to be fixed in macOS 11+. but still exists in macOS 10.15+

In essence that means that no Catalyst app using audio will exist for macOS Catalina ! That's a pitty

Regards
Chris