NSFoundationVersionNumber and iOS Versions

2019-04-10 15:43发布

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 :)

标签: ios version
3条回答
女痞
2楼-- · 2019-04-10 16:11

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.

查看更多
我只想做你的唯一
3楼-- · 2019-04-10 16:15

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)

查看更多
smile是对你的礼貌
4楼-- · 2019-04-10 16:22

With iOS 8, Apple now provides the NSOperatingSystemVersion struct in NSProcessInfo

You can use it with the isOperatingSystemAtLeastVersion:, or just check the 3 fields to exactly know which system version is running your app.

查看更多
登录 后发表回答