开发者

Detect when an ejectable device is (un)plugged in OS X

开发者 https://www.devze.com 2023-02-16 05:56 出处:网络
I am wondering how to be notified when a mass storage devic开发者_Go百科e is plugged (or unplugged) to the Mac.If you\'re writing a Cocoa app you can register for NSWorkspace notifications that fire w

I am wondering how to be notified when a mass storage devic开发者_Go百科e is plugged (or unplugged) to the Mac.


If you're writing a Cocoa app you can register for NSWorkspace notifications that fire when disks are mounted or unmounted.

At a lower level (more appropriate if you're writing a daemon or NSWorkspace doesn't give you enough information) you can use the Disk Arbitration Framework.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号