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.

In Category: Apple, ios, Xcode

Ravi Shankar

A polyglot software developer and now exploring Swift and iOS development. If you would like to learn from me then check out services page.

Show 0 Comments
No comments yet. Be the first.

Leave a Comment