问题描述
如果您将应用程序设置为部署到早期版本,则最新的Xcode IDE要求您定位iPhone SDK 4,同时动态处理已弃用的新功能。
The latest Xcode IDE requires you to target iPhone SDK 4 while dynamically handling deprecated and new functionality if you set the application to deploy to earlier releases.
我也可以使用像Blocks这样的新功能,它仍然可以在运行iPhone OS 3.0或3.1或3.1.3的设备上运行吗?
So can I use new features like Blocks and still have it work on a device running iPhone OS 3.0 or 3.1 or 3.1.3?
我还没有找到关于如何进行向后兼容的文档以前的iPhone OS版本。如果你能指出我的官方文档,其中包括如何做到这一点,我会很感激。
I have not found documentation on how to do backward compatibility for previous iPhone OS versions. If you could point me to official docs which cover how this should be done I'd appreciate it.
推荐答案
虽然最简单的事情要做的是尝试它,我认为它们不会造成伤害,如果存在但不使用(例如,你使用运行时if语句来绕过使用4.0之前的设备上的代码的块),但它们将会当然不能在4.0之前的设备上运行,并且Apple提供的使用块的所有API都无法使用。总而言之,如果你有办法在没有块的情况下做一些事情,没有理由采用不同的方法来实现块 - 这只会增加冗余和重复的代码 - 因此如果你希望定位4.0之前的设备,你不应该使用块,但如果你想/需要使用块,不要将目标操作系统定位在4.0以下
While the easiest thing to do is try it, I think that they wont cause harm if present but not used (eg. you use a runtime if statement to circumvent the blocks using code on pre-4.0 devices), but they will certainly not run on pre-4.0 devices, and all of the APIs Apple provides that use blocks will be unavailable anyway. All in all, if you have a way to do something without blocks, there is no reason to have a different way to do it with blocks -- this just increases redundancies and duplicated code -- therefore if you wish to target pre-4.0 devices, you should not use blocks, but if you want/need to use blocks, don't target OSes below 4.0
这篇关于为iPhone 4 SDK构建的块可以在部署到iPhone OS 3.0时运行吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!