本文介绍了如何使用LaunchDaemons(启动)启动Program.app?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已将以下 com.apple.test.plist 文件放置在文件夹中:
I've placed the following com.apple.test.plist file in the folder:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.apple.Spotlight</string>
<key>ProgramArguments</key>
<array>
<string>/Users/todd/Dropbox/client/CLIENT.BUILDS/MAC/v0.1/ApplicationTest.app</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
但是由于某些原因,当我使用用户todd登录时,ApplicationTest.app无法启动.
But for some reason ApplicationTest.app does not start when i login with my user todd.
有什么想法吗?
推荐答案
键ProgramArguments
需要一个可执行文件,但是您提供了一个应用程序捆绑包,它是一个精美的目录.为了启动应用程序,您必须将启动指向捆绑包中的可执行文件:
The key ProgramArguments
expects an executable file but you provided an application bundle, which is a glorified directory. In order to start the application you have to point launchd to the executable inside the bundle:
<key>ProgramArguments</key>
<array>
<string>/Users/todd/Dropbox/client/CLIENT.BUILDS/MAC/v0.1/ApplicationTest.app/Contents/MacOS/ApplicationTest</string>
</array>
或者使用open(1)
命令运行该应用程序:
Alternatively use the open(1)
command to run the application:
<key>ProgramArguments</key>
<array>
<string>/usr/bin/open</string>
<string>-W</string>
<string>/Users/todd/Dropbox/client/CLIENT.BUILDS/MAC/v0.1/ApplicationTest.app</string>
</array>
这篇关于如何使用LaunchDaemons(启动)启动Program.app?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!