Talking about IOS version number

Source: Internet
Author: User

Fir.im has been trying to be compatible with different use of the version number form, but in use we found that many developers on how to better use the version number to mark the application is very strange. This is a basic article that briefly describes the version number of IOS.

noun explanation
    • version, which is commonly said, is the identity that the app uses to advertise the user's description. Generally there are 2 or 3 segments, such as: 2.1 ,8.1.2

VersionGenerally determined by the product department, completely different updates need to change the major version number, such as QQ 4.0 the change is very large, the major version of the changes will be more appealing to the user's eye, so some applications will frequently update the major version number, such as FireFox 20.0 . The two-segment version number includes both a minor feature update and bug fixes, and three Segment version is basically a new feature added and big bug fixes, the third paragraph indicates that the stable version is basically fixed bug

    • Build, which refers to a unique compilation identifier, usually an incrementing integer (Android Force is a number, IOS can be a string)

Buildare for internal use and are used to determine a unique version. There is no big connection to the previous Version.

In IOS development, this 2 number can be any string or number.

The situation we are currently experiencing is:

    • Version or Build was ignored. One of these two numbers is not going to change in a year.

    • The Version and Build are reversed.

Getting a method is also simple:

Nsdictionary *info= [[NSBundle Mainbundle] infodictionary];info[@ "cfbundleshortversionstring"]; versioninfo[@ "Cfbundleversion"]; Build
Why use a version number1. Convenient marking and communication

The earlier mention of version number update will have a positive effect on the promotion. So the version number is not too long, if like this "we solemnly launched a certain 1.7.14.19257!", this will make users feel very dull and like TV shopping, but also not conducive to the spread. If it is "XXX 3.0, very different!" may result in better communication.

2. Easy to track bugs

A Bug in an application is certain, but a quick fix to the problem reflects the ability of the team and the programmer. We often meet developers who say I submit a version, but the download is still old. When we helped him solve the problem, he couldn't figure out which one was, and if he could show the current version in a place like "about", it would be easy to find the problem.

Or a colleague of the Test team, there may be several different versions of the branch in hand that are tested, and they need to accurately describe a beta version.

Automatically change Build number

As mentioned earlier, Version it is not necessary to automatically change, according to the needs of the product or marketing department, the timely manual change is good.

1. Agvtool (apple-generic versioning tool)

Agvtool, Apple's command-line tool, is also the most convenient tool to integrate with Xcode. This is the method we used in the script that automatically compiles the SDK. In fact, a line (other advanced usage can refer to the previous link):

Agvtool next-version

Need a simple configuration in Xcode before use:

2. SCM-based version control number

SCM is now commonly used with Git and SVN, there are some relatively small, such as HG here do not introduce more.
If you use GIT/SVN to manage your code (and believe that no one is using it), we can replace the build number with the number of commits to the code.

    • Git

rev= ' git rev-list HEAD | Wc-l | awk ' {print '} '

HEADThis is the branch name, which represents the current branch and can be replaced directly with other branch names, for example master dev .
This script is placed in

    • Svn

rev= ' Svnversion-nc | Sed-e ' s/^[^:]*://;s/[a-za-z]//'

The following are the same:

Plistbuddy-c "Set:cfbundleversion ${rev}" "${target_build_dir}"/${infoplist_path}

This will automatically add the version number to the Info.plist key value each time the app is compiled. CFBundleVersion

Add the above 2 lines of code to "Build Phase > Run Script" to:

3. Based on date time

Using release dates as a good version is also a common way for many applications, because it's good to understand. Here is the code directly attached:

rev= ' Date +%y%m%d ' #输出格式141120的六位日期格式, you can change the format according to your liking

The following are the same:

Plistbuddy-c "Set:cfbundleversion ${rev}" "${target_build_dir}"/${infoplist_path}

Use the same method as above.

How to use

As long as the version number is configured, other things do not require manual intervention, here are 2 kinds of usage scenarios.

1. Crash Collection

Collecting Crash is a necessary part of application development, and it can greatly improve the stability of the application by analyzing and repairing the Crash information, which will not let more users disappoint or even delete the application.
At present, there are many collection tools, such as Fir.im's BUGHD, Crashlytics and so on.

2. User Feedback

Users who can actively feedback the problem are the best users, regardless of whether the requirements are reasonable we have to seriously treat.
Whether it is using various SDKs or e-mail to try to bring the version number, System information, to facilitate the identification of user needs. The worst thing to do in "about" is to let the user find relevant version information to describe the problem.


Talking about IOS version number

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.