简体   繁体   中英

OS X Sandboxing: LSOpenFromURLSpec() returned -10827

We are using a little helper application for starting our main app after login. But we aren't able to launch our main app because LSOpenFromURLSpec() returns the error code -10827.

It doesn't matter if we are using:

[[NSWorkspace sharedWorkspace] launchApplication:@"/Applications/Appname.app"];

or:

[[NSWorkspace sharedWorkspace] launchApplication:@"Appname"];

It returns the error everytime. How can we fix that?

According to the LaunchServices headers, that error means it can't find an executable in the app bundle:

kLSNoExecutableErr            = -10827, /* The executable is missing*/

You allude to OS X sandboxing in your title, so I'm assuming you've run into this problem with a sandboxed app. It's possible that you're not allowed to launch other applications with your app's current entitlements. A simple way to test would be to write an unrestricted command line tool that only calls -launchApplication: .

尝试这个:

[[NSWorkspace sharedWorkspace] launchApplication:@"/Applications/Appname.app/Contents/MacOS/Appname"];

What about:

NSRunningApplication *newAppRunning = [[NSWorkspace sharedWorkspace] launchApplicationAtURL:[[NSBundle mainBundle] bundleURL] options:NSWorkspaceLaunchAsync | NSWorkspaceLaunchNewInstance configuration:nil error:&erroer];

This would allow to relaunch the current App. Probably it works if they both are in the same App Group.

see also: Is it possible to relaunch an app when sandbox deployed?

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM