ARC Compatibility Macros

If you ever find yourself writing code that needs to support being compiled with ARC (Automatic Reference Counting) both enabled and disabled this will likely be useful for you.

Firstly however, unless you have a good reason as to why your code needs to be compatible with ARC enabled and disabled, its probably a better idea  to just pick one and use the ARC enabling / disabling compiler flags for the particular files in question.  (-fobjc-arc / -fno-objc-arc)

Some places where it might however be easier in the long run include re-usable categories and classes that people will likely be including in their projects. ie open source stuff.

These are the macros that i used when adding ARC support to RHAddressBook a while back. Hopefully they are useful to others.

ARC Compatibility Macros — Gist.

Leave a Reply

Your email address will not be published. Required fields are marked *