我有一个分区的路径.如何在不使用终端命令的情况下以编程方式检索该分区的UUID?一个例子会更有帮助. 您可以使用磁盘仲裁框架( Apple reference). Chris Suter在 blog还有一个很好的总结. 您
您可以使用kDADiskDescriptionMediaUUIDKey获取UUID. Aaron Burghardt在这个邮件列表thread中描述得很好.以下是该链接的引用:
Once you have the DADisk, use DADiskCopyDescription to get a dictionary of properties, in which you will find the UUID with the key kDADiskDescriptionMediaUUIDKey (see DADisk.h for other keys that may be of interest). Note, a DADisk is a wrapper around an IOMedia object and the description dictionary corresponds directly to the properties in the IOMedia object. Also, CFShow() is useful for printing the description dictionary to the console.