I want my app to auto start if the user select the option. The methods I have been using is not allowed anymore in sandboxed apps.
I know I have to create a helper to a
I've just re-done about 100 trial on Tim's tutorial. Finally I made it work. Although I swear it worked when I first time tried it. In my situation is when I switch "Launch at login" to On, I can only see the helper app launched for just one second right after login. Then it was gone. Manually start the app, I saw the switch was turned off.
Here was what I found:
NSArray *running = [[NSWorkspace sharedWorkspace] runningApplications]NSRunningApplication *app (bundle name equal to my app) is:
[app isActive] == NO, [app isHidden] == NO, [app isTerminated] = NOSo I made some modification to the code like:
BOOL alreadyRunning = NO;
BOOL isActive = NO; // my modification
NSArray *running = [[NSWorkspace sharedWorkspace] runningApplications];
for (NSRunningApplication *app in running) {
if ([[app bundleIdentifier] isEqualToString:@"com.mybundleidentifier"]) {
alreadyRunning = YES;
isActive = [app isActive]; // my modification
}
}
if (!alreadyRunning || !isActive) { // my modification
....