How do I get the icon from another application using Objective-C?
I have tried this so far, however it just returns null
:
NSURL *path = [NSU
The icon file of an application is usually defined in its Info.plist under the CFBundleIconFile key. By obtaining the icon file name, you can then get this icon from the Resources directory of a bundle (path-to-anApplication/Contents/Resources/).
To get the Info.plist contents, you can either load it directly in an NSDictionary (using dictionaryWithContentsOfFile:) or get it from the bundle object of the application (example : [[NSBundle bundleWithPath:path-to-anApp] infoDictionary])
.
The icon file will be the value of the CFBundleIconFile key (i.e.: iconFile = [infoDictionary valueForKey:@"CFBundleIconFile"]
. Its path will then be : path-to-anApplication/Contents/Resources/iconFile).