Hi how could I tell in my OSSystemExtensionRequestDelegate
if the request I receive is either an activation request or a deactivation one.
func request(_ request: OSSystemExtensionRequest, didFinishWithResult result: OSSystemExtensionRequest.Result) {
guard result == .completed else {
return
}
// Take different actions depending on activation/deactivation
}
The normal approach here would be to serialise your requests, that is, not issue a deactivate until the activate request has finished and vice versa. If you do that you can then determine the type of request by tracking the last request you made.
Alternatively, you could use a different type of delegate object for each request type.
Finally, be aware that activate and deactivate aren’t your only options. The API was designed to be extended to support other request types, and indeed we’ve added a new one in macOS 12 beta (the properties request) [1].
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
[1] Which I didn’t know about until I looked at the header today (-: