Hi, I am developing an application in cocoa.I need to check whether iTunes is installed or not in the machine.Is there any way to find the installed applications????
sometimes people delete stuff.
Graham Lee
2009-07-09 07:14:57
What if the software is used in a managed lab environment where the sysadmins have removed iTunes as it's not being used for academic reasons?
Jeff Kelley
2009-07-13 15:07:19
+7
A:
The function LSFindApplicationForInfo() can take a bundle ID (e.g. com.apple.iTunes
), so you can find out whether iTunes is installed by trying to look it up.
To answer the second part of your question, there is a hidden interface on LaunchServices to get a list of all application names. However, as your goal is to find whether iTunes is installed, don't use it - just look for iTunes.
Graham Lee
2009-07-09 07:14:28
Or one could even use -[NSWorkspace absolutePathForAppBundleWithIdentifier:] (which probably calls down to LSFindApplicationForInfo() anyway)
Mike Abdullah
2009-07-09 12:13:28
+1
A:
As was mentioned by Mike Abdullah the correct cocoa call is:
NSString* iTunesPath = [ [ NSWorkspace sharedWorkspace ]
absolutePathForAppBundleWithIdentifier: @"com.apple.iTunes" ];
if( iTunesPath ) {
// iTunes installed, do something
}
Jon Steinmetz
2009-07-12 17:58:52