Can Blocks built for the iPhone 4 SDK work when deployed to iPhone OS 3.0?

前端 未结 4 1432
借酒劲吻你
借酒劲吻你 2021-01-19 06:04

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

4条回答
  •  佛祖请我去吃肉
    2021-01-19 06:43

    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

提交回复
热议问题