CameraExtension and Uninstaller

I need to write macOS App, CameraExtension(CMIO) and Uninstaller app. Bundle ID is like this

  • App : com.my.app
  • CameraExtension : com.my.app.cameraex
  • Uninstaller app : com.my.app.unisntaller

My App can activate CameraExtension by OSSystemExtensionRequest.activationRequest.

But Uninstaller cannot deactivate CameraExtension. I got error : Error Domain=OSSystemExtensionErrorDomain Code=4 "Extension not found in App bundle: perhaps App is not validly structured"

I set AppGroup and add SystemExtension feature and provision for uninstaller. I guess "com.my.app.unisntaller" cannot deactivate "com.my.app.cameraex".

What kind of Bundle ID should I use for my uninstaller? Writing App and Uninstaller is correct way for CameraExtension? My manager ask to provide easy method for removing all modules.

your camera extension will be removed from the system when the user deletes the app from /Applications. They'll see a warning when they do so, it says something like "this app includes an extension which will be deleted if you delete this app, are you sure?".

So if your app only contains a camera extension, you don't really need an uninstaller - everything goes away when the user deletes the app.

Your installer can't deactivate the extension because the uninstaller's bundle ID is "com.my.app.unisntaller" and the extension you are trying to activate has a bundle ID which is not prefixed by "com.my.app.unisntaller". Two things here:

  1. did you intentionally mis-spell "uninstaller" in your bundle ID?
  2. If you have an uninstaller, it should just delete the app hosting the extension, and the OS will take care of unloading the extension

you don't really need an uninstaller - everything goes away when the user deletes the app.

My app installed CameraExtension and audio driver under /Library/Audio/Plug-Ins/HAL/MyAudio.driver After user delete my app under /Applications, the driver files under /Library/Audio/Plug-Ins/HAL/MyAudio.driver still exists. I need to provide uninstaller for deleting audio driver.

OS will take care of unloading the extension

I found OS only take care of unloading camera extension. OS does not take care Audio Extension.

com.my.app.unisntaller is typo. Correct ID is com.my.app.uninstaller.

I like to know which Bundle ID can deactivate "com.my.app.cameraex". "com.my.app" only or "com.my.app.[anyID]"

I see. I didn't know that you installed other items. In this case, yes you would use an uninstaller. But the uninstaller doesn't need to deactivate the camera extension, all it needs to do is delete the hosting app. The camera extension will be deactivated and eventually deleted from the system. If the extension is still in use, it won't be unloaded until the hardware is unplugged or the system restarts.

On macOS, the bundle ID of the extension and the hosting app don't have to be related. The Xcode template project sets up related bundle IDs, there's no good reason to stray from the practice. On iOS/iPad OS, the extension's ID must begin with hosting app's ID.

Usually, the team ID of the extension and the host ID have to match, unless you have the com.apple.developer.system-extension.redistributable entitlement (macOS only)

I don't know whether another app can deactivate your driver. Maybe it only works if the uninstaller also contains the driver extension (even if it would never activate it?).

But it shouldn't be necessary anyway - just delete the camera extension's hosting app, and your audio plug-in.

I delete hosting app by "Finder" -> "/Applications/MyApp.app" -> "Move to Trash". But "systemextensionsctl list" still says "[Activated and Enabled]" on MyApp's CameraExtension.

I tested with "sudo rm -rf /Applications/MyApp.app". Same result, MyApp's CameraExtensions is still activated and enabled.

Currently I need to implement these tasks.

  • Uninstaller calls the hosting app with "uninst" argument.
  • Hosting App with "uninst", open app with blank view. Deactivate the extension and quit
  • Uninstaller delete other items like /Library/Audio/Plug-Ins/HAL/MyAudio.driver
  • Uninstaller delete /Applications/MyApp.app
CameraExtension and Uninstaller
 
 
Q