How to check which applications enabling SMLoginItemSetEnabled?
Terminal or which folder, file contains it?
I run 2 applications below but it can't launch at login => I need check helper app is enabling or not.
How to check which applications enabling SMLoginItemSetEnabled?
Terminal or which folder, file contains it?
I run 2 applications below but it can't launch at login => I need check helper app is enabling or not.
You can check the login item status using SMJobCopyDictionary(or even SMCopyAllJobDictionaries) like this:
- (BOOL)launchAtLoginWithBundleId:(NSString*)bundleId {
CFDictionaryRef dict = SMJobCopyDictionary(kSMDomainUserLaunchd, (CFStringRef)bundleId);
if (dict == NULL) {
return NO;
}
CFRelease(dict);
return YES;
}
Apple didn't recommend use
SMJobCopyDictionary
@discussion The contents of the returned dictionary are NOT wholy representative of the property list on-disk and are not stable from release to release. This routine is deprecated and will be removed in a future release. There will be no provided replacement.
Better use SMCopyAllJobDictionaries method
BOOL enabled = NO;
NSArray *jobs = (NSArray*)SMCopyAllJobDictionaries(kSMDomainUserLaunchd);
if (jobs || [jobs count]>0) {
for (NSDictionary *job in jobs) {
if ([[job objectForKey:@"Label"] isEqualToString:bundleId]) {
ret = [[job objectForKey:@"OnDemand"] boolValue];
break;
}
}
}
[jobs release];