How to get the version and build details

Created by Alin Brindusescu on 2011-12-12 15:22:40

If you use to develop for iOS with Xcode you noticed that in the project settings page you have a version and build number. I was wondering how could I get them in my code to format a string for the about message. Here is how I manage to get this:

 
    NSDictionary *projectInfo = [[NSBundle mainBundle] infoDictionary];
    NSString *appName = [projectInfo objectForKey:@"CFBundleDisplayName"];
    NSString *appVersion = [projectInfo objectForKey:@"CFBundleShortVersionString"];
    NSString *appBuild = [projectInfo objectForKey:@"CFBundleVersion"];
    NSString *appVersionStr = [NSString stringWithFormat:@"%@ V%@ R%@", appName, appVersion, appBuild];
 

Comments: work in progress!

Search

Ads