Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我为 Mac 编写了一个应用程序,其中一个组件是在后台运行的 launchctl 代理。
由于通过拖动到垃圾箱来删除 Mac 应用程序(我可以理解这个逻辑,但在多年的 Windows 开发后习惯了),我想知道当用户删除应用程序时我可以做些什么来清理自己?
特别是正在运行的后台进程及其 .plist 文件。
编辑:在对这个问题进行了更多思考之后,我想在后台进程文件上放置一个监听器,如果它被删除就会收到通知,然后从 launchctl 中删除自己,删除 plist 并杀死自己。这行得通吗?