麦克外部驱动器未被识别为可移动存储
我有一个外部 1TB 驱动器,我的程序无法将其识别为可移动存储设备。
我的代码中有以下几行来检测连接到计算机的可移动驱动器。
NSArray *removableDrivesPaths = [[NSWorkspace共享工作空间] MountedRemovableMedia];
请你们告诉我一种方法,让我的外部驱动器被检测为可移动存储设备,或者是否有任何其他可可框架功能可以用来将我的外部驱动器检测为可移动存储设备。
谢谢
I have a external 1TB drive which is not getting recognized by my program as removable storage device.
I have in my code the following lines to detect the removable drives attached to the machine.
NSArray *removableDrivesPaths = [[NSWorkspace sharedWorkspace] mountedRemovableMedia];
Please can you guys tell me a method to get my external drives get detected as removable storage devices or if there is any other cocoa framework function that i can use to detect my external drives as removable storage devices.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
“可移动”介质是一种物理上与其所在驱动器不同的介质,即软盘或 CD 驱动器。所以不退回外部硬盘是正确的。不过,我不确定您将如何找到您想要的信息。
"Removable" media is one that is physically distinct from the drive it is placed within - i.e. a floppy or a CD drive. So this is correct in not returning external hard drives. I'm not sure how you would go about finding the information you want, though.
从 OS X 10.7 开始,NSURL API 有两个键
NSURLVolumeIsLocalKey
和NSURLVolumeIsInternalKey
。外部驱动器应该是本地的,但不是内部的。另外,NSURLVolumeIsInternalKey
必须不为nil
(对于已安装的磁盘映像,它为 nil)。Starting from OS X 10.7, NSURL API has two keys
NSURLVolumeIsLocalKey
andNSURLVolumeIsInternalKey
. External drives should be local, but not internal. AlsoNSURLVolumeIsInternalKey
must be notnil
(it is nil for mounted disk images).不确定您要做什么,但如果您只想从设备访问文件,它应该显示为 /Volumes 下的驱动器。
Not sure what you're trying to do, but if you'd just like to access files from the device it should appear as a drive under /Volumes.