Hi all,
It's nice that macOS 15 allows users to control System Extensions in "Login Items & Extensions", but I am encountering some issues in determining if a user has disabled or removed a System Extension.
I will share my findings (as of macOS 15.1 24B5009l) for two scenarios and would appreciate any suggestions for better approaches.
Scenario 1: During first-time activation, there is no clear API to determine if the user uninstalls the extension before activation.
The code creates activationRequestForExtension:queue:
and receives notifications via a delegate implementing OSSystemExtensionRequestDelegate
. However, if the user does not authorize the activation of the System Extension and uninstalls it, the code receives request:didFailWithError:
with error code OSSystemExtensionErrorRequestSuperseded
. This error code is ambiguous, so I plan to submit a propertiesRequestForExtension:queue:
and check the properties for each instance to determine if the user uninstalled the extension.
Scenario 2: After activation, it is unclear when the user enables or disables the extension.
It is somewhat easier in the enabled -> disabled scenario. The XPC connection will be invalidated, allowing me to submit another propertiesRequestForExtension:queue:
in the XPC invalidation handler and check the result.
However, I am having trouble with the disabled -> enabled scenario. There is no event or trigger indicating that the user has enabled the extension, so I have to submit propertiesRequestForExtension:queue:
repeatedly at short intervals, which is not ideal.
I wonder if there are better approaches. Any suggestions would be greatly appreciated.
Thanks & regards,
Shay
Scenario 1
Your approach seems reasonable enough. I’m a big fan of -propertiesRequestForExtension:queue:
, in that I don’t really care how the user got to a given point, I just care where they are.
Scenario 2
There is no event or trigger indicating that the user has enabled the extension
Indeed. I encourage you to file an enhancement request requesting such a notification. Please post your bug number, just for the record.
Is your sysex one that starts immediately on activation. If so, you could have the sysex post a notification on start and have the app listen for that.
I’m talking about Darwin notification here, per the notify
man page.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"