(macOS) Is it any App Store safe method to close other apps from a sandboxed app?

Hi there. I made a macOS app for personal use time ago and, since I find it very useful, I'd wish to release it in the App Store. The thing is my app needs to close user selected applications. I am doing it without any problem using the app bundle identifier but, of course, it doesn't work if I enable the "sandboxed" entitlement.

So my question is: is there any "legal" way to do this simple task or is just simply impossible to do it from an App Store app? I would found the later pretty weird since the user has explicitly give permissions by drag and drop the app he/she wants to close.

I'd appreciate any help on this.

Thanks

Answered by DTS Engineer in 738419022

is … is just simply impossible to do it from an App Store app?

This.

I would found the later pretty weird since the user has explicitly give permissions by drag and drop the app he/she wants to close.

If the user drags another app on to your app, that’ll extend the sandbox to give your app access to the other app on the file system. It doesn’t have relationship to the process running the other app.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Accepted Answer

is … is just simply impossible to do it from an App Store app?

This.

I would found the later pretty weird since the user has explicitly give permissions by drag and drop the app he/she wants to close.

If the user drags another app on to your app, that’ll extend the sandbox to give your app access to the other app on the file system. It doesn’t have relationship to the process running the other app.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Well, I still think it is weird and not user friendly since the user has dragged the app precisely to allow my app to close it. ¯_(ツ)_/¯

Anyway, I'll accept it and will try to release my app without that feature although it's less useful that way. Thank you for yout help.

since the user has dragged the app precisely to allow my app to close it.

Look at this from macOS’s perspective. How does it know that this drag’n’drop means “It’s OK to terminate this process” versus, say, “It’s OK to compress this app”?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

There actually is a hacky way to close other apps from a sandboxed app: Given accessibility permissions, you can send command-Q keystroke events to another app. I think there should be a cleaner way for a sandboxed app to close other apps, with some permissions and/or entitlements. I've sent FB11876087 about it.

(macOS) Is it any App Store safe method to close other apps from a sandboxed app?
 
 
Q