Automatic Reference Counting on iOS 3.x

2019-07-18 19:57发布

问题:

Does an app compiled with arc turned on work with iOS 3.1.x devices? Ideally I would like to make our app work only with iOS 4.x and higher but we have some users still running iOS 3.x. I no longer have access to devices with iOS 3.

Has anyone tested?

回答1:

I wouldn't count on ARC working back to iOS 3.x until you've at least found official documentation to that effect and perhaps tested it yourself as well. Here's at least one opinion that supports the notion that apps written using ARC may not even work on all versions of iOS 4.



回答2:

ARC is only available on iOS 4.0 and above. Additionally automatic real reference nil-ing is only available on iOS 5.0 and above.



回答3:

If you set the deployment target to pre 5.0 the compiler will automatically insert the memory management (retain/release) for you. So yes, it will work.