MacOS: AudioUnit packaged as .appex won't load when host app is sandboxed

Hi,

I'm working on an audio mixing app, that comes with bundled audio units that provide some of the app's core functionality.

For the next release of that app, we are planning to make two changes:

  • make the app sandboxed
  • package the bundled audio units as .appex bundles instead as .component bundles, so we don't need to take care of the installation at the correct spot in the file system

When trying this new approach, we run into problems where [[AVAudioUnitEffect alloc] initWithAudioComponentDescription:] crashes when trying to load our audio unit with the exception:

AVAEInternal.h:109 [AUInterface.mm:468:AUInterfaceBaseV3: (AudioComponentInstanceNew(comp, &_auv2)): error -10863

Our audio unit has the `sandboxSafe flag enabled, and loads fine when the host app is not sandboxed, so I'm guessing I got the bundle id/code signing requirements for the .appex correct.

It seems, that my .appex isn't even loaded, and the system rejects it because of its metadata. Maybe there something wrong the Info.plist generated by Juice?

  "BuildMachineOSBuild" => "23H222"
  "CFBundleDisplayName" => "elgato_sample_recorder"
  "CFBundleExecutable" => "ElgatoSampleRecorder"
  "CFBundleIdentifier" => "com.iwascoding.EffectLoader.samplerecorderAUv3"
  "CFBundleName" => "elgato_sample_recorder"
  "CFBundlePackageType" => "XPC!"
  "CFBundleShortVersionString" => "1.0.0.0"
  "CFBundleSignature" => "????"
  "CFBundleSupportedPlatforms" => [
    0 => "MacOSX"
  ]
  "CFBundleVersion" => "1.0.0.0"
  "DTCompiler" => "com.apple.compilers.llvm.clang.1_0"
  "DTPlatformBuild" => "24C94"
  "DTPlatformName" => "macosx"
  "DTPlatformVersion" => "15.2"
  "DTSDKBuild" => "24C94"
  "DTSDKName" => "macosx15.2"
  "DTXcode" => "1620"
  "DTXcodeBuild" => "16C5032a"
  "LSMinimumSystemVersion" => "10.13"
  "NSExtension" => {
    "NSExtensionAttributes" => {
      "AudioComponents" => [
        0 => {
          "description" => "Elgato Sample Recorder"
          "factoryFunction" => "elgato_sample_recorderAUFactoryAUv3"
          "manufacturer" => "Manu"
          "name" => "Elgato: Elgato Sample Recorder"
          "sandboxSafe" => 1
          "subtype" => "Znyk"
          "tags" => [
            0 => "Effects"
          ]
          "type" => "aufx"
          "version" => 65536
        }
      ]
    }
    "NSExtensionPointIdentifier" => "com.apple.AudioUnit-UI"
    "NSExtensionPrincipalClass" => "elgato_sample_recorderAUFactoryAUv3"
  }
  "NSHighResolutionCapable" => 1
}

Any ideas what I am missing?

Hello @iljawascoding, thank you for your post. With an AudioComponentDescription, you instantiate audio unit extensions with instantiate(with:options:completionHandler:). To get a list of component descriptions matching some criteria, you call components(matching:). Please refer to the Incorporating Audio Effects and Instruments for further information and an example implementation.

Thanks for the quick response.

I changed my code to use AVAudioUnit.instantiate(with: effectDesc, options: .loadInProcess), and I'm now getting a different exception:

AUNSExtension.mm:100 Failed to open AudioUnit extension: Error Domain=com apple.ViewBridge Code=14 "(null)"
UserInfo={com.apple.ViewBridge.error.hint=-[NSViewServiceMarshal bootstrap:withReply:] caught NSInternalInconsistencyException 'NSDictionaryOfVariableBindings failed because either one of the values is nil, or there's something wrong with the way the macro is being invoked. Cannot assign value nil for key "childView". Keys:(
not assign value nil for key "childView"- Keys: ( angs rated because eatnes
childView

So it seems this new approach tries to load my audio units editor UI, even though the audio unit declares to have no UI. It also tries to load the UI when instantiating the audio unit, even though requestViewController wasn't even called.

Any ideas how to work around this? Are UI-less Audio Units no longer supported in the Audio Unit v3 interface?

Hello @iljawascoding. Is the sample code app able to load your AUv3 extension? If not, there could be something wrong with your implementation. When you run the auval tool, does your extension pass validation?

Hi @iljawascoding. Interestingly, this is one of few links I ran into when trying to figure out why the Elgato Sample Recorder is being flagged as incompatible in both FCP and Logic Pro. The current version fails Apple AU validation process. While users can opt to ignore the notification, this is not a common issue. I have not seen any plugins that cause the issue in recent years. Perhaps this will help send you in a direction to help solve the issue...for both you and Wave Link / FCP / Logic users.

There must be some other

Elgato Support is leaning back on info from the development team:

This component, while possibly coded in a similar format to other AU plugins, is not intended to be used outside of Wave Link. It is a Wave Link specific component by design. On Mac systems, these types of components have a very specific path that is required, hence being stored in the Components folder of the Plugins folder. This is an audio processing component, but was not intended to be used in other apps. It may or may function as expected in other apps, even if recognized or able to be accessed.

MacOS: AudioUnit packaged as .appex won't load when host app is sandboxed
 
 
Q