A comment on an old StackOverflow answer of mine took me to task for a “partial answer” so I decided to improve it. Both posters wanted to know if a mounted device is a disk image. I wrote a simple routine using the DiskArbitration framework to test this given a file URL.
BOOL isDMG = [someObject isDMGVolumeAtURL:[NSURL fileURLWithPath:@"/Volumes/Some Volume"]];
In the above “
someObject” refers to whatever object you put this method in, of course. It should probably be a category on
NSURL (so you could ask the url directly:
BOOL isDMG = [volumeMountPointURL isDMG];). I hope you find it useful!