AVAudioEngine crashes Quick Look Preview Extension on iOS 15

Hi,

I'm trying to write a Quick Look extension for my iOS app.

However, I'm having issues initializing AVAudioEngine in my QLPreviewingController subclass from preparePreviewOfFile. The following error messages are printed to the console after attempting to initialize AVAudioEngine, and the Quick Look Extension crashes with EXC_BAD_ACCESS.

The same code works fine within the main iOS app. It also works on macOS inside a Catalyst app on the macOS Monterey RC when previewing a file in the Finder.

I've also filed feedback with feedback number FB9713048.

Thanks for taking a look at this.

Console output:

[audiocomp] AudioComponentPluginMgr.mm:545   reg server remote proxy error Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.audio.AudioComponentRegistrar was invalidated: failed at lookup with error 159 - Sandbox restriction." UserInfo={NSDebugDescription=The connection to service named com.apple.audio.AudioComponentRegistrar was invalidated: failed at lookup with error 159 - Sandbox restriction.}
[as] AudioSessionClientManager.cpp:475   Couldn't connect to com.apple.audio.AudioSession Error: 1100; AudioSession will not be usable
[aurioc]            AURemoteIO.cpp:148   Couldn't connect to com.apple.audio.AURemoteIOServer; AURemoteIO will not be usable
[aurioc]            AURemoteIO.cpp:148   Couldn't connect to com.apple.audio.AURemoteIOServer; AURemoteIO will not be usable
[default] AURemoteIO is passing a serverPID of 0 to CheckRPCError!
[default] CheckRPCError: AURemoteIO returned server mach error 0x10000003!
[aurioc]            AURemoteIO.cpp:148   Couldn't connect to com.apple.audio.AURemoteIOServer; AURemoteIO will not be usable
[aurioc]            AURemoteIO.cpp:148   Couldn't connect to com.apple.audio.AURemoteIOServer; AURemoteIO will not be usable
[default] AURemoteIO is passing a serverPID of 0 to CheckRPCError!
[default] CheckRPCError: AURemoteIO returned server mach error 0x10000003!
[aurioc]            AURemoteIO.cpp:148   Couldn't connect to com.apple.audio.AURemoteIOServer; AURemoteIO will not be usable
[aurioc]            AURemoteIO.cpp:148   Couldn't connect to com.apple.audio.AURemoteIOServer; AURemoteIO will not be usable
[default] AURemoteIO is passing a serverPID of 0 to CheckRPCError!
[default] CheckRPCError: AURemoteIO returned server mach error 0x10000003!
[aurioc]            AURemoteIO.cpp:148   Couldn't connect to com.apple.audio.AURemoteIOServer; AURemoteIO will not be usable
[aurioc]            AURemoteIO.cpp:148   Couldn't connect to com.apple.audio.AURemoteIOServer; AURemoteIO will not be usable
[default] GetProperty is passing a serverPID of 0 to CheckRPCError!
[default] CheckRPCError: GetProperty returned server mach error 0x10000003!
[aurioc]            AURemoteIO.cpp:148   Couldn't connect to com.apple.audio.AURemoteIOServer; AURemoteIO will not be usable
[aurioc]            AURemoteIO.cpp:148   Couldn't connect to com.apple.audio.AURemoteIOServer; AURemoteIO will not be usable
[default] SetProperty is passing a serverPID of 0 to CheckRPCError!
[default] CheckRPCError: SetProperty returned server mach error 0x10000003!
[aurioc]            AURemoteIO.cpp:148   Couldn't connect to com.apple.audio.AURemoteIOServer; AURemoteIO will not be usable
[aurioc]            AURemoteIO.cpp:148   Couldn't connect to com.apple.audio.AURemoteIOServer; AURemoteIO will not be usable
[default] Initialize is passing a serverPID of 0 to CheckRPCError!
[default] CheckRPCError: Initialize returned server mach error 0x10000003!
[aurioc]            AURemoteIO.cpp:1123  failed: 268435459 (enable 2, outf< 2 ch,      0 Hz, Float32, deinterleaved> inf< 2 ch,      0 Hz, Float32, deinterleaved>)
throwing -10878
throwing -10878
throwing -10878
throwing -10878
throwing -10878
throwing -10878
throwing -10878
throwing -10878
throwing -10878
[aurioc]            AURemoteIO.cpp:148   Couldn't connect to com.apple.audio.AURemoteIOServer; AURemoteIO will not be usable
[aurioc]            AURemoteIO.cpp:148   Couldn't connect to com.apple.audio.AURemoteIOServer; AURemoteIO will not be usable
[default] SetProperty is passing a serverPID of 0 to CheckRPCError!
[default] CheckRPCError: SetProperty returned server mach error 0x10000003!
[aurioc]            AURemoteIO.cpp:148   Couldn't connect to com.apple.audio.AURemoteIOServer; AURemoteIO will not be usable
[aurioc]            AURemoteIO.cpp:148   Couldn't connect to com.apple.audio.AURemoteIOServer; AURemoteIO will not be usable
[default] Initialize is passing a serverPID of 0 to CheckRPCError!
[default] CheckRPCError: Initialize returned server mach error 0x10000003!
[aurioc]            AURemoteIO.cpp:1123  failed: 268435459 (enable 2, outf< 2 ch,  44100 Hz, Float32, deinterleaved> inf< 2 ch,      0 Hz, Float32, deinterleaved>)
[avae]            AVAEInternal.h:109   [AVAudioEngineGraph.mm:1344:Initialize: (err = PerformCommand(*outputNode, kAUInitialize, NULL, 0)): error 268435459
[avae]          AVAudioEngine.mm:167   Engine@0x2830594d0: could not initialize, error = 268435459
[aurioc]            AURemoteIO.cpp:148   Couldn't connect to com.apple.audio.AURemoteIOServer; AURemoteIO will not be usable
[aurioc]            AURemoteIO.cpp:148   Couldn't connect to com.apple.audio.AURemoteIOServer; AURemoteIO will not be usable
[default] SetProperty is passing a serverPID of 0 to CheckRPCError!
[default] CheckRPCError: SetProperty returned server mach error 0x10000003!
[aurioc]            AURemoteIO.cpp:148   Couldn't connect to com.apple.audio.AURemoteIOServer; AURemoteIO will not be usable
[aurioc]            AURemoteIO.cpp:148   Couldn't connect to com.apple.audio.AURemoteIOServer; AURemoteIO will not be usable
[default] Initialize is passing a serverPID of 0 to CheckRPCError!
[default] CheckRPCError: Initialize returned server mach error 0x10000003!
[aurioc]            AURemoteIO.cpp:1123  failed: 268435459 (enable 2, outf< 2 ch,  44100 Hz, Float32, deinterleaved> inf< 2 ch,      0 Hz, Float32, deinterleaved>)
[avae]            AVAEInternal.h:109   [AVAudioEngineGraph.mm:1344:Initialize: (err = PerformCommand(*outputNode, kAUInitialize, NULL, 0)): error 268435459
[avae]     AVAudioEngineGraph.mm:4631  Can't retrieve source node to play sequence because there is no output node!
[aurioc]            AURemoteIO.cpp:148   Couldn't connect to com.apple.audio.AURemoteIOServer; AURemoteIO will not be usable
[aurioc]            AURemoteIO.cpp:148   Couldn't connect to com.apple.audio.AURemoteIOServer; AURemoteIO will not be usable
[default] GetProperty is passing a serverPID of 0 to CheckRPCError!
[default] CheckRPCError: GetProperty returned server mach error 0x10000003!
(lldb) 

@eskimo, would you be able to help with this?

The issue still occurs on iOS 15.1 (19B74).

AVAudioEngine crashes Quick Look Preview Extension on iOS 15
 
 
Q