core audio – ExtAudioFileRead throwing AVAudioSessionErrorCodeResourceNotAvailable error on iOS and iPadOS 18

Calls to ExtAudioFileRead are throwing OSStatus 561145203 (AVAudioSessionErrorCodeResourceNotAvailable) on iOS and iPadOS 18 — earlier versions of iOS have not exhibited this behavior. This is a longstanding code path that has suddenly seen a spike of these error codes since iOS 18’s release.

e.g.

AudioBufferList audioFileBufferList;
audioFileBufferList.mNumberBuffers = 1;
audioFileBufferList.mBuffers[0].mNumberChannels = clientAudioStreamBasicDescription.mChannelsPerFrame;
audioFileBufferList.mBuffers[0].mDataByteSize = bytesToRead;
audioFileBufferList.mBuffers[0].mData = (void*)mData;
                
UInt32 ui32FramesToRead = framesToRead;
OSStatus status = ExtAudioFileRead(file.audioFile, &ui32FramesToRead, &audioFileBufferList);
// 561145203 status

The following is also printed in the Xcode 16 console:

enter image description here

Has anyone else experienced troubles with iOS 18 in this area?

Read more here: Source link