Disabling ARC on Specific Files in XCode 08/17/2011
ARC (Automatic Reference Count) was introduced with XCode 4.2. This means that you no longer have to release, autorelease, or retain in your code. This makes it easier when writing code but a little difficult when importing or copying code snippets from existing code written for older versions. You might get errors such as 'release' is unavailable: not available in automatic reference counting mode or ARC forbids explicit message send of 'release' or ARC forbids explicit message send of 'autorelease' To avoid these errors, you can disable arc for your imported files. Here is how: 1. Click on your project in the Project Navigator, and then on the Target. 2. Under "Build Phases", expand "Compile Sources". 3. Click on the file you want to edit and type in -fno-objc-arc. It should appear in the "Compiler Flags" column. Tags: IOS, iPhone, iPad, iPod, ARC, Automatic Reference Count, disable, turn off, XCode, Cocoa, Objective-C Commentslandon 10/19/2011 21:06
thanks lee, your solution saved me. we've been building an app using phonegap and 2 files were killing me because of arc.
Reply
Michael 10/24/2011 12:40
I tried this solution but cant seem to get it to work. After I insert the compiler flags and build the app it keeps crashing in the dealloc methods. If I trying to convert to project to ARC even with the compiler flags the same errors come up as if the flags werent there. Furthermore Xcode removes the flags afterwards. Did I miss something?
Reply
Towhid 12/06/2011 21:20
Hi, Thanks.....Saved lots of time.....
Reply
mudface 12/20/2011 13:54
Thanks for the tip!
Reply
Mohamed Hamdi 01/03/2012 02:31
Many thansk
Reply
wzbozon 01/03/2012 16:22
thanks, this is useful
Reply
sss 02/12/2012 22:54
tnx pal
Reply
Leave a Reply | Life BlogI am a 35 year old father of two who enjoys various aspect of life. I have many interests and I think its crucial to continue learning in life. This blog is where I will share all my "study" notes including everything from programming, parenting, hang gliding, sailing, and anything else I may be learning at the time. CategoriesAll |


RSS Feed