NSFoundationVersionNumber和iOS版本

The*_*ris 4 version 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
}
Run Code Online (Sandbox Code Playgroud)

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

非常感谢你 :)

Leo*_*ica 6

如果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及更高版本.

  • 是的,包括所有版本.如果你想知道哪个,你将不得不向下钻取`[UIDevice currentDevice] .systemVersion`. (2认同)
  • 这不是100%真实.6_0和6_1具有相同的基础编号(在NSObjCRuntime.h中找到993.00).因此,对于<NSFoundationVersionNumber_iOS_6_1,设备为5.1及以下.小点. (2认同)