Trying to make my app works with sandboxing I get stuck in this problem:
I need to add my App to login items so I've followed these steps:
Creating an HelperApp.app (with is agent = YES
) that at the open exec this code :
NSString *appPath = @"/Applications/MyNewApp.app";
[[NSWorkspace sharedWorkspace] launchApplication:appPath];
[NSApp terminate:nil];
This app is sandboxed.
I added a copy build phase to my MyNewApp.app bundle with subpath Contents/Library/LoginItems
and destination wrapper
And obviously also the MyNewApp.app is sandboxed
In MyNewApp.app I registered with SMLoginItemSetEnabled
the bundle id for the HelperApp.app
Now all works correctly but... when MyNewApp.app tries to launch MyNewApp.app I get an error:
LSOpenFromURLSpec() returned -10827 for application /Applications/MyNewApp.app path (null).
But if I try to use the HelperApp.app to launch a not sandboxed (i.e. Steam.app) app it works like a charm!
Is there another way to launch the app? probably NSWorkSpace works with functions not allowed in sandbox context. What do you suggest?
Android sandboxThe Android platform isolates apps from each other and protects them -- and the overall system -- from malicious apps and intruders. Android assigns a unique user ID (UID) to each application to create a kernel-level sandbox. This kernel ensures security between apps and the system at the process level.
iOS and iPadOS help ensure runtime security by using a “sandbox,” declared entitlements, and Address Space Layout Randomization (ASLR).
You may want to have a look at my tutorial on how to get launch at login working in the sandbox.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With