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.
如果您打开了一个文档并想要卸载一个卷,os x 会打开此警告面板,说明该文档仍在由程序 x 使用。你怎么能在可可中得到关于这个的通知?我尝试了 DADiskArbitration 框架,但是在磁盘成功卸载之前它不会发送回调。
你有什么想法吗?
您可以调用lsofusingNSTask来获取打开文件的列表。用于lsof +D /Volumes/<volume name>将搜索范围缩小到您感兴趣的已安装卷中打开的文件。
lsof
NSTask
lsof +D /Volumes/<volume name>