Programmatically add application icon to dock on install

孤人 提交于 2019-12-01 02:07:26

问题


I would like my application to be automatically added to the dock after the package (DMG) is installed?

Does anyone know how to do this?


回答1:


There's a couple ways to do this, Andrew, and a lot of this depends on how you're doing your application installing.

If you are using PackageMaker to install your app, you can run a "postflight" script which adds your app's icon to the "defaults" (i.e. the preferences) of the dock. This older MacRumors thread shows how to do that.

If you are not using PackageMaker, then you might have to run an Applescript from within your app that does the same "defaults" writing trick. Here's a thread on AskDifferent that shows how.

In both cases you need to kill the dock (or Finder?) and restart it in order to get the change to pick up and show.



来源:https://stackoverflow.com/questions/13451234/programmatically-add-application-icon-to-dock-on-install

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!