SMJobBless - documentation on when an administrator password is requested

I cannot find any documentation about this, so I hope someone can confirm the behavior that I see with the Apple SMJobBless sample .

I got the impression that he would only ask for the administrator password if he finds that it is necessary to install a new version of the auxiliary tool.

However, this impression is apparently incorrect.

The behavior that I see under 10.6 is that if I first started the application, it will ask for a password. If I start almost immediately, this will not happen. However, if I wait long enough, he will again ask for a password. During all this, the auxiliary tool does not change.

Can someone point out documentation that defines this as the correct behavior?

+5
source share
1 answer

If anyone is interested, this (probably) turned out to be a mistake, and one was filed. rdar: // 10280469

The way the system works at the moment is that it will ask for the administrator password every time, regardless of whether the SMJobBless function should install the auxiliary tool or not. The error (probably) is that the administrator password request should not be executed if the auxiliary tool does not need to be installed (for example, it is already installed and has the same version as in the application bundle).

, , , , SMJobBless SMJobBless , , .

, (SMJobCopyDictionary ), , , , , .

() , , .

, . , , .

NSDictionary* installedHelperJobData;

installedHelperJobData  = (NSDictionary*)SMJobCopyDictionary( kSMDomainSystemLaunchd, (CFStringRef)@"com.apple.bsd.SMJobBlessHelper" );

NSString*       installedPath           = [[installedHelperJobData objectForKey:@"ProgramArguments"] objectAtIndex:0];
NSURL*          installedPathURL        = [NSURL fileURLWithPath:installedPath];

NSDictionary*   installedInfoPlist      = (NSDictionary*)CFBundleCopyInfoDictionaryForURL( (CFURLRef)installedPathURL );
NSString*       installedBundleVersion  = [installedInfoPlist objectForKey:@"CFBundleVersion"];
NSInteger       installedVersion        = [installedBundleVersion integerValue];

NSLog( @"installedVersion: %ld", (long)installedVersion );

NSBundle*       appBundle       = [NSBundle mainBundle];
NSURL*          appBundleURL    = [appBundle bundleURL];

NSURL*          currentHelperToolURL    = [appBundleURL URLByAppendingPathComponent:@"Contents/Library/LaunchServices/com.apple.bsd.SMJobBlessHelper"];
NSDictionary*   currentInfoPlist        = (NSDictionary*)CFBundleCopyInfoDictionaryForURL( (CFURLRef)currentHelperToolURL );
NSString*       currentBundleVersion    = [currentInfoPlist objectForKey:@"CFBundleVersion"];
NSInteger       currentVersion          = [currentBundleVersion integerValue];

NSLog( @"currentVersion: %ld", (long)currentVersion );
+12

All Articles