如何使iPhone应用程序与2.2.1和3.1 SDK兼容? [英] How can I make a iPhone app compatible to 2.2.1 and 3.1 SDK?
本文介绍了如何使iPhone应用程序与2.2.1和3.1 SDK兼容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在2.2.1中制作了一些应用程序,当我在3.1中运行相同的应用程序时,它会出错。
更改代码是我不想要的解决方案。
我正在寻找一些预处理器指令,可以让我的应用程序兼容两个SDK。
类似 #ifdef
。
I have made some apps in 2.2.1 now when I run the same app in 3.1 it gives errors.
Changing the codes is a solution I am not looking for.
I am looking for some pre-processor directives that can make my app compatible to both SDKs.
Something like #ifdef
.
谢谢大家。
推荐答案
您可以使用此#define更改为每个SDK构建的内容...
You can use this #define to change what you build for each SDK...
#if __IPHONE_OS_VERSION_MIN_REQUIRED > __IPHONE_2_2
// iPhone 3.0 code here
#endif
And do this at run-time to run code for 3.0 and above:
float version = [[[UIDevice currentDevice] systemVersion] floatValue];
if (version >= 3.0){
// iPhone 3.0 code here
}
这篇关于如何使iPhone应用程序与2.2.1和3.1 SDK兼容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文