1. Get the current version information of the app
#define Xcodeappversion [[[NSBundle Mainbundle] infodictionary] objectforkey:@ "cfbundleshortversionstring"]
This is the macro definition provided by Umeng statistics, when using Umeng, you need to set the app version information, as shown below,
[Mobclick setappversion:xcodeappversion]; parameter is NSString * Type, custom app version information, if not set, default from Cfbundleversion
2, iOS system version comparison,
#define Ksystemversion [[Uidevice Currentdevice] systemversion]
This macro can get iOS version information, such as 5.0.1 or 5.1, etc.
NSString *currentsystemversion = ksystemversion;if ([currentsystemversion compare:@ "5.1"]! = NSOrderedAscending) {//current iOS version is greater than 5.1}else if ([Currentsystemversion compare:@ "5.0.1"]! = nsorderedascending) {//The current iOS version is greater than 5.0.1}
The nsorderedasceding documentation is explained below,
(the left operand are smaller than the right operand, the parameters on the side are less
This comparison is convenient, not only to compare 5.1 and 6.1, but also to refine the comparison to the 5.1 and 5.0.1 versions. The refinement is due to the fact that there are some differences in the SDK between each iteration, such as avoiding files being backed up to icloud, which are implemented in 5.1 and 5.0.1 different ways.
iOS Development Tips-version comparison