NSFoundationVersionNumber and iOS Versions

有些话、适合烂在心里 提交于 2019-12-06 06:33:46

问题


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


回答1:


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.




回答2:


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)




回答3:


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.



来源:https://stackoverflow.com/questions/19990900/nsfoundationversionnumber-and-ios-versions

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!