NSFoundationVersionNumber和iOS版本

好吧,我猜我的问题非常简单。

我使用NSFoundationVersionNumber来检查我的应用程序的版本,并使其兼容iOS6和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 } 

好吧,据我所知,Apple发布了6.1.X版本。所以,使用第二个“else-if”语句,版本6.1.X被排除在我所做的兼容版本列表之外?如果答案是肯定的,那么如果设备在6.1.X版本上运行,我该如何判断?

非常感谢你 :)

NSFoundationVersionNumber == NSFoundationVersionNumber_iOS_6_1为真时,则设备具有6.1.X.

NSFoundationVersionNumber == NSFoundationVersionNumber_iOS_6_0为真时,设备具有6.0.X.

NSFoundationVersionNumber < NSFoundationVersionNumber_iOS_6_0为真时,设备具有5.1.X及以下。

NSFoundationVersionNumber > NSFoundationVersionNumber_iOS_6_1为真时,设备具有7.0及更高版本。

apple忘了为iOS 7,10.8和10.9提供NSFoundationVersionNumber常量,但你可以通过NSLogging出你的NSFoundationVersionNumer(它给你当前操作系统的NSFoundationVersionNumber)来获取数字

在iOS 8中,Apple现在在NSOperatingSystemVersion中提供NSOperatingSystemVersion结构

您可以将它与isOperatingSystemAtLeastVersion: ,或者只需检查3个字段即可准确了解正在运行您的应用的系统版本。