Programmatically determining application versions

Discussion in 'Mac Programming' started by frankpuccino, Aug 15, 2010.

  1. frankpuccino macrumors newbie

    Joined:
    Jul 24, 2010
    #1
    Suppose I want to determine the versions of applications that are installed on a user's machine.

    Is it "correct" to take the application's bundle identifier, go to the application bundle directory, and then pull the Info.plist out of the bundle and look at the version number there?

    Or is there a better way?

    Frank
     
  2. Peter Maurer macrumors member

    Joined:
    Oct 9, 2008
    #3
    If you only need this to work with apps that are packaged as bundles, you can also just use NSBundle, e.g.:

    Code:
    [[NSBundle bundleWithPath: @"/path/to/an.app"] objectForInfoDictionaryKey: @"CFBundleShortVersionString"]
     
  3. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #4
    The terminal command

    Code:
    system_profiler SPApplicationsDataType -xml
    will produce an XML file with all app details. You can redirect this to a file, parse it with an XML parser, whatever
     

Share This Page