如何使代码与IOS 5和IOS 4兼容[iphone] [英] How to make code compatible for both IOS 5 and IOS 4 [iphone]

查看:53
本文介绍了如何使代码与IOS 5和IOS 4兼容[iphone]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在一个新项目上.我希望我的代码与IOS4和IOS5 SDK兼容.我需要我所有的功能都可以在IOS4和IOS5中使用.就是说,我不打算在IOS5中使用新功能(明智地使用功能)并为IOS4禁用该功能.

I am on a new project. I want my code compatible to be for both IOS4 and IOS5 SDKs. I need all my functionalities work both in IOS4 and IOS5. That said, i am not planning to use new features in IOS5 (feature wise) and disable that feature for IOS4.

我有2个选择.让我知道哪个最好?

I have 2 options. Let me know which is best ?

  1. IOS4的目标和代码.我认为这在IOS5中也可以正常工作.
  2. BaseSDK IOS5和目标IOS4.(无论如何我现在都不打算使用ARC或情节提要).

我认为使用方法2时,在我同时使用每种用法时必须格外小心,因为我没有使用情节提要和ARC,因此没有任何好处.所以希望第一更好.

I think with method #2, i have to be extra careful while using each usages at the same time as i am not using story board and ARC , there are no benefits. So hope #1 is better.

让我知道专家的意见.

注意:将来如果需要切换到IOS5新功能,希望仅此ARC会成为障碍,这也是可选的,我可以轻松切换rt?

Note: in future if need to switch to IOS5 new features , hope only this ARC will be the blocking and that is also an optional thing and i can easily switch rt?

推荐答案

选择第一个.如果您要为iOS4开发应用程序,并且没有使用iOS5的任何新功能,那么就不要让自己变得更复杂.

Go with the first one. If you're making your app for iOS4 and you're not using anything new from iOS5 then don't make things more complicated for yourself.

您要使用第二个选项的唯一实时时间是当您想使用iOS5中的某些新功能,但仍希望它与iOS4兼容时,在这种情况下,您将必须对您的程序当前正在运行的iOS版本.

The only real time you want to use the second option is when you want to use some of the new features in iOS5 but you still want it to be compatible on iOS4, in which case you will have to put in conditional checks for the iOS version that your program is currently being run on.

顺便说一句,ARC仍然与iOS4兼容.

By the way, ARC is compatible to iOS4 anyway.

这篇关于如何使代码与IOS 5和IOS 4兼容[iphone]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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