How to launch application and bring it to front using Cocoa api?

后端 未结 7 1104
滥情空心
滥情空心 2020-11-29 07:27

I\'m very new to a cocoa programming and I can\'t find the way to do the following:

  • Start a particular application by name
  • Do some work
  • Later
7条回答
  •  生来不讨喜
    2020-11-29 08:13

    To start an application, use the NSWorkspace class: NSWorkspace Reference

    Specifically, the launchApplication: function.

    I don't know the answer of the activation part off my head. You can activate your own application with -[NSApplication activateIgnoringOtherApps:], but I don't know how to do it for other apps.

提交回复
热议问题