Search code examples
objective-cxcodereference-counting

Using older libraries with new Reference Counting in XCode


The latest version of XCode supports reference counting. However many older libraries are not compatible with the new Reference Counting architecture.

Is there a Compiler option or something to use non Reference Counted libraries with a new reference counted app, or do I always have to update the code?

What happens with libraries that use C (obviously not reference counted)?


Solution

  • You can do this. In the build phases tab for the target you want to change, you can set compiler flags for each file in your project under the Compile Sources section.

    Simply set the compiler flags for the files you don't want to use ARC on to:

    fno-objc-arc
    

    disable ARC example

    You can hold Cmd while selecting files to add the flag to several files at once.