How to display the current project version of my App to the user?

After further searching and testing, I found the solution myself.

NSDictionary* infoDictionary = [[NSBundle mainBundle] infoDictionary];
NSLog(@"%i Keys:  %@", [infoDictionary count],
             [[infoDictionary allKeys] componentsJoinedByString: @" ,"]);

This snipplet gave me the following output:

20 Keys : NSBundleResolvedPath ,CFBundleVersion ,NSBundleInitialPath ,CFBundleIdentifier ,NSMainNibFile ,CFBundleIconFile ,CFBundleInfoPlistURL ,CFBundleExecutable ,DTSDKName ,UIStatusBarStyle ,CFBundleDevelopmentRegion ,DTPlatformName ,CFBundleInfoDictionaryVersion ,CFBundleSupportedPlatforms ,CFBundleExecutablePath ,CFBundleDisplayName ,LSRequiresIPhoneOS ,CFBundlePackageType ,CFBundleSignature ,CFBundleName

So the solution is as simple as:

NSString *version =[[[NSBundle mainBundle] infoDictionary] valueForKey:@"CFBundleVersion"];

However, this is not the Current Project Version as seen in the screenshot but the Bundle Version of the plist file.

Leave a Comment