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 (ie 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?
您可能希望查看我的教程, 了解如何在沙箱中登录时启动 。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.