How to disable arc for specific classes in Xcode

Xcode provides option to disable arc only for specific classes by providing a compiler flag. This is quite useful when you are including framework written prior to iOS 5 in your project. Let us see the steps required for specifying the compiler flag in Xcode.

ARC errors in Xcode

In the above screenshot, you can see errors rested ARC restrictions for NSStream+ SKSMTPExtensions.m class file. You can resolve this error by providing the compiler flag -fno-objc-arc for this class.

201402041850.jpg

Click the Project on Xcode then Build Phases tab. Navigate to Compile Sources section and double click on Compiler flags for the corresponding file. Now enter the flag “ -fno-objc-arc” as shown in the below screenshot.

disable ARC in Xcode

This should resolve all the compilation related with ARC.


Comments

One response to “How to disable arc for specific classes in Xcode”

  1. Thanks Ravi,
    I’m learning Objective C and this ARC error was starting to frustrate me. Thanks for this article. It was a big help to me!

    Dave

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.