- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我似乎找不到任何相关文档,所以希望有人可以确认我在 Apple 样本 SMJobBless 中看到的行为。代码。
我的印象是,如果它检测到需要安装新版本的帮助工具,它只会要求输入管理员密码。
但是,这种印象显然是不正确的。
我在 10.6 下看到的行为是,如果我第一次启动该应用程序,它会要求输入密码。如果我几乎立即启动,它就不会。但是,如果我等待足够长的时间,它会再次要求输入密码。在这整个过程中,辅助工具不会改变。
任何人都可以指出将其定义为正确行为的文档吗?
最佳答案
如果有人感兴趣,这(可能)被证明是一个错误并且已经被提交。雷达://10280469
系统目前的工作方式是,无论SMJobBless功能是否需要安装帮助工具,每次都会要求输入管理员密码。该错误(可能)是,如果不需要安装帮助工具(例如,它已经安装并且与应用程序包中的版本相同),则不应发出管理员密码请求。
因此,这意味着需要在调用 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 );
关于macos - SMJobBless - 有关何时要求管理员密码的文档,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7603226/
我似乎找不到任何相关文档,所以希望有人可以确认我在 Apple 样本 SMJobBless 中看到的行为。代码。 我的印象是,如果它检测到需要安装新版本的帮助工具,它只会要求输入管理员密码。 但是,这
我有一个工作区,其中有 2 个项目,一个是安装程序应用程序,另一个是卸载程序应用程序。这两个应用程序都需要权限帮助工具来执行某些操作。我正在尝试编写一个通用工具作为工作区中的第三个项目,该项目将与现有
我正在尝试使用 SMJobBless 安装一个安全的帮助工具。当它失败并且在调用 SMJobBless 之前,我正在调用 SMJobRemove,因为我需要删除该工具的旧版本并且这成功了。 SMJob
我们正在开发一个带有辅助工具的应用程序 - 该工具使用 SMJobBless 安装到系统中。这按预期工作;但有一个警告。 我们经常进行自动部署 - 有时每周一次以上。每次帮助工具版本发生变化时,我们都
有一个苹果SMJobBless展示如何安全安装辅助工具的示例。 SMJobBlessXPC它使用 Mach 端口上的 XPC (c API) 在应用程序和特权帮助工具之间进行通信。 我需要使用 NSX
我正在做一些需要定期将文件安装到/Library 文件夹中的事情。 我知道在过去我可以使用其中一种 Authenticate 方法,但这些方法在 10.7 中已被弃用。 到目前为止,我从阅读中了解到的
尽管自 Mac OS X Leopard 以来 API 已经开放,但令人惊讶且不幸的是,关于如何正确使用 SMJobBless() 创建特权帮助工具的文档非常少。有很多问题,即使直接从 Apple 的
我尝试通过 SMJobBless 安装辅助工具,但收到以下错误, Error Domain=CFErrorDomainLaunchd Code=8“操作无法完成。(CFErrorDomainLaunc
文档指出,对于SMJobBless,您只能使用kSMDomainSystemLaunchd SMJobBless(kSMDomainSystemLaunchd, (CFStringRef)label,
有人知道这个错误代码是什么意思吗?我收到带有此返回代码值的 SMJobBless 错误。 Failed to bless helper: Error Domain=CFErrorDomainLaunc
我一直在阅读文档和 SMJobBless 示例以及 Internet 上的各种讨论。我的应用现在使用 SMJobBless() 安装了一个特权助手,但该助手根本没有运行。 助手的全部目的是在应用程序启
我们在使用 SMJobBless 更新帮助工具时遇到了问题,这几天一直困扰着我们。 我们正在开发一个应用程序,在某些时候我们需要执行管理任务(加载/卸载 kext)。我们还使用钥匙串(keychain
SMJobBlessUtil.py脚本(Apple 提供用于设置/检查特权帮助工具与其主应用程序之间的配对)在 M1 Mac 上不起作用。 $ ./SMJobBlessUtil.py check My
简短版本:删除应用程序时是否可以删除应用程序设置的帮助工具(SMJobBless() 等)?如果是这样,如何? 长版: 不幸的是,我们正在开发的 Mac 应用程序需要管理员权限才能执行偶尔的操作,而且
我尝试使用 SMJobBless 为我的应用程序制作辅助工具;当我按照段落进行设置时: http://www.tanhao.me/pieces/1623.html/ 当我运行时,xcode 给我: S
运行 SMJobBless: (PrefPane 项目 xcode 版本 4 Build 4A304a) SMJobBless(kSMDomainSystemLaunchd, @"com.codera
SMJobBless是用于Privileged Helper工具,但是如果我想将launchd plist复制到/Users//Library/LaunchAgents我该怎么办。我不想输入任何用户密
我是一名优秀的程序员,十分优秀!