Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Refer to build number or version number in code

It's easy to set the build and version numbers manually in Xcode, and I learned how to increment them with a macro at build time. But how do I reference their values in code?

like image 946
RobertL Avatar asked Apr 04 '12 16:04

RobertL


People also ask

What is the difference between version number and build number?

The versionCode is the incremental build number in Android. Show activity on this post. Every new upload of APK on Play Google requires versionCode to be different (ideally one up). This is a number.

What is build number in version?

A build number is a specific identifier that lets you know what software you're running as well as when it was updated last. That means your Android build number will change pretty frequently — maybe every month, depending on your device.

How do you define a build version?

In a programming context, a build is a version of a program that, as a rule, is a pre-release version and is identified by a build number rather than by a release number. Simply put, a software build is a set of executable code that is ready for use by customers.

What is version code and version name?

The version code is an incremental integer value that represents the version of the application code. The version name is a string value that represents the “friendly” version name displayed to the users.


1 Answers

NSDictionary *infoDict = [[NSBundle mainBundle] infoDictionary]; NSString *appVersion = [infoDict objectForKey:@"CFBundleShortVersionString"]; // example: 1.0.0 NSString *buildNumber = [infoDict objectForKey:@"CFBundleVersion"]; // example: 42  
like image 188
Andrew Madsen Avatar answered Oct 06 '22 09:10

Andrew Madsen