」工欲善其事,必先利其器。「—孔子《論語.錄靈公》
首頁 > 程式設計 > OS X中如何獲取活動應用列表?

OS X中如何獲取活動應用列表?

發佈於2025-05-02
瀏覽:594

How to Retrieve a List of Active Applications in OS X? 
在OS X

答案:

利用蘋果的Swift和Cocoa Frameworks,可以在OSX。 The resulting app object is an NSApplication instance that contains the necessary information, including the desired bundle identifier.

Implementation Details:

The NSWorkspace class provides access to system-level information about running applications.

The runningApplications property返回代表活動應用程序的NSapplication實例的數組。 每個NSApplication實例包含一個bundledentifier屬性,該屬性獨特地標識了應用程序捆綁包。

可以使用較低級別的C API來實現相似的功能,但是上面的解決方案在大多數情況下都證明了足夠的。
最新教學 更多>

免責聲明: 提供的所有資源部分來自互聯網,如果有侵犯您的版權或其他權益,請說明詳細緣由並提供版權或權益證明然後發到郵箱:[email protected] 我們會在第一時間內為您處理。

Copyright© 2022 湘ICP备2022001581号-3