iPhone检查固件版本 [英] iPhone check firmware version
问题描述
HI all
我想为iPhone 2.2。*和版本3.0制作一个应用程序。
2.2 *中的某些方法在3.0中已弃用。 (比如UITableViewCell setText和setLabel)
I want to make one app for iPhone 2.2.* and for version 3.0. Some method in 2.2* is deprecated in 3.0. ( like UITableViewCell setText and setLabel )
有没有办法检查iPhone上使用的固件版本并设置不同的使用方法
Is there any way to check which firmware version is used on iPhone and to set different method to use
推荐答案
您需要使用预处理器指令进行条件编译,例如__IPHONE_3_0,并构建两个单独的可执行文件。
You will need to use pre-processor directives for the conditional compilation such as __IPHONE_3_0 and build two separate executables.
例如:
#ifdef __IPHONE_3_0
// code specific to version 3
#else
// code specific to version 2
#end
如果您需要在运行时检测版本,可以使用[[UIDevice currentDevice] systemVersion]。它返回当前版本的iPhone OS的字符串。
If you need to detect the version at run-time you can use [[UIDevice currentDevice] systemVersion]. It returns the string with the current version of the iPhone OS.
这篇关于iPhone检查固件版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!