如何在运行时确定当前的iPhone OS版本并比较版本字符串? [英] How to determine the current iPhone OS version at runtime and compare version strings?

查看:65
本文介绍了如何在运行时确定当前的iPhone OS版本并比较版本字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何确定和比较(>,<等等)运行该应用程序的iPhone的当前操作系统版本? 3.0中有一个错误,但3.1+中没有,所以如果当前操作系统版本不是> = 3.1,我希望能够跳过一些代码。

How can you determine and compare (>, <, etc.) the current OS version of the iPhone that the app is running on? There is a certain bug in 3.0 but not in 3.1+ so I'd like to be able to skip out a bit of code if the current OS version is not >= 3.1.

这需要在运行时而不是编译时间!

This needs to be at runtime not compile time!

推荐答案

你的意思是确定操作系统的版本? SDK在构建时修复,但操作系统可能会更改。要获取操作系统版本,请使用[UIDevice currentDevice]。 systemVersion。要获得SDK版本,我认为您可以使用__IPHONE_OS_VERSION_MIN_REQUIRED。

Do you mean determine the version of the OS? The SDK is fixed at build time, but the OS may change. To get the OS version, use [UIDevice currentDevice]. systemVersion. To get the SDK version, I think you can use __IPHONE_OS_VERSION_MIN_REQUIRED.

这篇关于如何在运行时确定当前的iPhone OS版本并比较版本字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆