How can I know how my app was launched on Mac OS?

萝らか妹 提交于 2019-12-07 13:11:01

问题


I've got a problem, and have been looking for a solution for a long time.

I made a application which has an option which will launch the app automatically when the system starts using Launch Services.

If application is launched by the user (ie. opening the .app) I want to do something.
If application is launch by Launch Services when the system starts I want to do another thing.

So I need to know how the app was launched: by the System (Launch Services loading the app when the computer turns on) or User (User opening the .app in the Finder).

How can I get this information? Any suggestions are weclome.

prethanks.

来源:https://stackoverflow.com/questions/6687824/how-can-i-know-how-my-app-was-launched-on-mac-os

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