Programmatically add application icon to dock on install

后端 未结 1 1564
小鲜肉
小鲜肉 2021-01-12 10:12

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条回答
  •  离开以前
    2021-01-12 10:23

    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.

    0 讨论(0)
提交回复
热议问题