[英]SMJobBless causes kSMErrorDomainFramework error 5 - The tool at the specified path is not valid
(PrefPane project xcode version 4 Build 4A304a) (PrefPane项目xcode版本4 Build 4A304a)
SMJobBless(kSMDomainSystemLaunchd, @"com.coderama.coderamaHelper", authRef, &err);
System Preferences[22312:903] Bless Error: Error Domain=kSMErrorDomainFramework Code=5 UserInfo=0x2005790e0 "The operation couldn’t be completed. (kSMErrorDomainFramework error 5 - The tool at the specified path is not valid.)"
Below are my plists. 以下是我的帖子。
Can anyone decipher the error message so I can attempt to troubleshoot this? 任何人都可以破译错误消息,以便我可以尝试解决此问题吗? I have gone over all of my plists to make sure the names match-up.
我已经查看了所有的帖子,以确保名称匹配。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>com.coderama.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2012 coderama. All rights reserved.</string>
<key>NSMainNibFile</key>
<string>coderama</string>
<key>NSPrefPaneIconFile</key>
<string>show_wireframe_zoom_24.gif</string>
<key>NSPrefPaneIconLabel</key>
<string>coderama</string>
<key>NSPrincipalClass</key>
<string>coderama</string>
<key>SMPrivilegedExecutables</key>
<dict>
<key>com.coderama.coderamaHelper</key>
<string>identifier com.coderama.coderamaHelper and certificate leaf[subject.CN] = "Joe Developer"</string>
</dict>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleIdentifier</key>
<string>com.coderama.coderamaHelper</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>coderamaHelper</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>SMAuthorizedClients</key>
<array>
<string>identifier com.coderama.coderama and certificate leaf[subject.CN] = "Joe Developer"</string>
</array>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.coderama.coderamaHelper</string>
<key>MachServices</key>
<dict>
<key>com.coderama.coderamaHelper.mach</key>
<true/>
</dict>
</dict>
</plist>
I went to this error too, at first check again the steps declared in the readme.txt of the SMJobless project: 我也去了这个错误,首先再次检查SMJobless项目的readme.txt中声明的步骤:
Finally make sure that THE DAEMON is embedded in the executable itself before Build it, this is accomplished by this way: In the helper tool or daemon go to target/Build Settings/Linking/Other Linker Flags and add the following: 最后确保在构建它之前将DAEMON嵌入到可执行文件中,这是通过以下方式实现的:在帮助工具或守护进程中转到目标/构建设置/链接/其他链接器标志并添加以下内容:
-sectcreate -sectcreate
__TEXT __文本
__info_plist __info_plist
MyDaemon/info.plist MyDaemon / info.plist中
-sectcreate -sectcreate
__TEXT __文本
_launchd_plist _launchd_plist
MyDaemon/myDaemon-launchd.plist MyDaemon / myDaemon-launchd.plist
Make sure to replace MyDaemon for the correct values of your own development. 确保将MyDaemon替换为您自己开发的正确值。 Be careful with the names of your info and launchd files.
请注意info和launchd文件的名称。
IMPORTANT TIP : THE NAME OF THE DAEMON OR SERVICE MUST CORRESPOND TO THE SAME NAME WRITTEN IN THE INFO.PLIST AND LAUNCHD.PLIST FILES OTHERWISE IT WILL GENERATE THE ERROR kSMErrorDomainFramework
error 5 - The tool at the specified path is not valid. 重要提示 :DAEMON或服务的名称必须与INFO.PLIST和LAUNCHD.PLIST文件中的相同名称相对应,否则将产生错误
kSMErrorDomainFramework
错误5 - 指定路径上的工具无效。
一位Apple开发人员回复我说SMJobBless
仅适用于Applications。
This error occurs when the helper tool is not bundled in the correct location, and so SMJobBless()
can't find the tool for installation. 如果辅助工具未捆绑在正确的位置,则会发生此错误,因此
SMJobBless()
无法找到要安装的工具。 In the Build Phases
section of your main application target, you have to add a Copy Files
build phase. 在主应用程序目标的
Build Phases
部分中,您必须添加Copy Files
构建阶段。 Add your helper tool, set the destination to Wrapper
and the subpath to Contents/Library/LaunchServices
, and SMJobBless()
will be able to find your helper tool. 添加帮助工具,将目标设置为
Wrapper
,将子路径设置为Contents/Library/LaunchServices
, SMJobBless()
将能够找到您的帮助工具。
Check the documentation for SMJobBless for the list of requirements. 查看SMJobBless的文档以获取要求列表。 My guess is that you missed step 1 (code-signing both the tool and your app) or step 5 (copying the tool to the correct place in your app wrapper).
我的猜测是你错过了第1步(对工具和应用程序进行代码签名)或第5步(将工具复制到应用包装器中的正确位置)。
Also, [NSString @"com.coderama.coderamaHelper"]
makes no sense. 另外,
[NSString @"com.coderama.coderamaHelper"]
毫无意义。 Just write @"com.coderama.coderamaHelper"
. 只需写
@"com.coderama.coderamaHelper"
。
If all else fails, look at what the sample code does and follow its example. 如果所有其他方法都失败了,请查看示例代码的作用并遵循其示例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.