Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSFoundationVersionNumber and iOS Versions

Tags:

version

ios

Well, my questions is really simple i guess.

I use NSFoundationVersionNumber to check the version of my app , and make it both compatible with iOS6 and iOS7 .

if (NSFoundationVersionNumber > NSFoundationVersionNumber_iOS_6_1 ){
//Here goes the code for iOS 7 
}

else if (NSFoundationVersionNumber == NSFoundationVersionNumber_iOS_6_1){
//Here goes the code for iOS 6.1
}

Well,as far as i know, Apple has released 6.1.X versions.So, using the second "else-if" statement, versions 6.1.X are excluded from the list of compatible versions i make?If yes is the answer, then how can i determine ,if the device is running on 6.1.X versions?

Thank you very much :)

like image 692
Themis Beris Avatar asked Dec 25 '22 17:12

Themis Beris


2 Answers

When NSFoundationVersionNumber == NSFoundationVersionNumber_iOS_6_1 is true, then the device has 6.1.X.

When NSFoundationVersionNumber == NSFoundationVersionNumber_iOS_6_0 is true, the device has 6.0.X.

When NSFoundationVersionNumber < NSFoundationVersionNumber_iOS_6_0 is true, the device has 5.1.X and below.

When NSFoundationVersionNumber > NSFoundationVersionNumber_iOS_6_1 is true, the device has 7.0 and above.

like image 176
Léo Natan Avatar answered Dec 28 '22 08:12

Léo Natan


apple forgot to provide NSFoundationVersionNumber constants for iOS 7, 10.8 and 10.9, but you can get the numbers by NSLogging out your NSFoundationVersionNumer (which gives you the NSFoundationVersionNumber of your current OS)

like image 28
haag Avatar answered Dec 28 '22 08:12

haag