Can locks created for the iPhone 4 SDK work when deployed to iPhone OS 3.0?

The latest Xcode IDE requires you to target the iPhone SDK 4 by dynamically processing obsolete and new features if you install the application for deployment in earlier versions.

So, can I use new features, such as blocks, and still work on a device running iPhone OS 3.0 or 3.1 or 3.1.3?

I did not find documentation on how to do backward compatibility for previous versions of the iPhone OS. If you could point me to official documents that will tell you how this should be done, I would appreciate it.

+4
source share
4 answers

While the easiest task is to try, I think that they will not harm if they are present but not used (for example, you use the runtime if statement to bypass blocks using code on devices up to 4.0), but they will of course , do not work on devices up to 4.0, and all Apple APIs ensure that the use of blocks will not be available in any case. In general, if you have a way to do something without blocks, there is no reason to have another way to do it with blocks - it just increases redundancy and duplicate code, so if you want to target devices to 4.0, you should not use blocks, but if you want / need to use blocks, do not target the OS below 4.0

+3
source

As far as I know, blocks will not work until 3.2, because Blocks runtime is not included (classes like __NSStackBlock__ or something else). Other than that, I understand that you can compile code with blocks if you use the new enough compiler. The solution would be to conditionally configure executable blocks with your project.

+4
source
0
source

No, blocks will not work on iPhone until 3.2 without PLBlocks - and even then any method accepting a block may not exist.

0
source

Source: https://habr.com/ru/post/1314972/


All Articles