I have a Main.app application and a Helper.app application in the Main.app/Library/LoginItems folder. The Main.app user can be started by the user, and the user can set Helper.app as an input element. (using SMLoginItemSetEnabled ()), this works fine. When the user sets Helper.app as an input element, it also starts.
However, it should also be possible to run Helper.app without setting it as an input element. I tried to do this with
[[NSWorkspace sharedWorkspace] launchApplication: newPath];
which gives lsboxd: does not allow the process to start ... an error, but with
[NSTask launchedTaskWithLaunchPath:newPath arguments: [NSArray array]]
which gives a ban on a sandbox ban. (presumably because Helper.app is inside Main.app?)
newPath is defined as follows:
NSMutableArray *pathComponents = [NSMutableArray arrayWithArray:[[[NSBundle mainBundle] bundlePath] pathComponents]];
[pathComponents addObject:@"Contents"];
[pathComponents addObject:@"Library"];
[pathComponents addObject:@"LoginItems"];
[pathComponents addObject:@"Helper.app"];
[pathComponents addObject:@"Contents"];
[pathComponents addObject:@"MacOS"];
[pathComponents addObject:@"Helper"];
NSString *newPath = [NSString pathWithComponents:pathComponents];
How can I fix this? :)
Thank,
source
share