I found my devices using IOServiceGetMatchingServicesand got a property dictionary as follows:
kernResult = IORegistryEntryCreateCFProperties(nextMedia,
(CFMutableDictionaryRef *)&props,
kCFAllocatorDefault, 0);
From this dictionary I can extract information for the icons:
NSString *bId = [props valueForKeyPath:@"IOMediaIcon.CFBundleIdentifier"];
NSString *rFile = [props valueForKeyPath:@"IOMediaIcon.IOBundleResourceFile"];
These two give me this (as an example):
com.apple.iokit.IOStorageFamily (Bundle identifier)
Internal.icns (Resource File)
I tried to extract the icon using this method:
NSBundle *bundleWithIcon = [NSBundle bundleWithIdentifier:bId];
NSString *iconPath = [bundleWithIcon pathForResource:rFile ofType:nil];
But bundleWithIconthere is nil.
Is this even the right method to get the badge?
I think I need to download the package somehow in order to download it using bundleWithIdentifier, how can I do this?
PS: Another question that (I think) is trying to ask the same thing, but only asks about the bundles, and not if this is the right way.