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.
Picture
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.
Picture
Tags: IOS, iPhone, iPad, iPod, ARC, Automatic Reference Count, disable, turn off, XCode, Cocoa, Objective-C
 


Comments

landon
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
01/10/2012 22:37

Under "Build Phases", expand "Compile Sources".

Reply
12/29/2012 00:26

If a project has already been created with ARC disabled, how do I enable it and vice versa?

Reply
sss
02/12/2012 22:54

tnx pal

Reply
02/20/2012 17:20

Yet another thank you!

Reply
Henrik
03/08/2012 08:00

Thanks a lot!!

Reply
hussain1982
04/10/2012 13:31

Thank you very mych

Reply
tutlegrand
04/25/2012 10:09

So many thanks, but another one : Thank you !
:-)

Reply
Amir
07/14/2012 10:25

clear and concise. Thanks a bunch

Reply
philostein
08/04/2012 21:17

Great! I would've had more luck finding the Higgs Boson than this. :)

Reply
babos
09/21/2012 08:05

very good !!!! But there's a method to apply this filter to all file in oneshot ;))))

Reply
10/05/2012 03:31

Works nicely. Thanks!

Reply
01/03/2013 02:03

Is it possible to disable ARC for individual files? if yes then please share the code or method.

Reply
liposuliminosBiroKotos
10/31/2012 07:20

Thanks!

Reply
Raj
11/23/2012 19:06

Worked like a charm - thanks dude.

Reply
02/05/2013 01:28

that is very useful information for us we hop that you always continue to post these type of information in future also

Reply

this really helps. thanks

Reply
03/05/2013 00:05

i agri your information

...........
thanks

Reply
03/19/2013 10:10

I can see that you made some conclusions on your own, so thats very valuable for readers like me.

Reply
04/17/2013 15:25

Thanks for the udpate, it helped me a lot!

Reply
04/23/2013 20:51

I have followed the steps which you have mentioned above..and It really works..

Reply
05/13/2013 02:59

By following the instructions mentioned in this web page you can easily disable the ARC on specific files in XCode. The procedure won’t be tough and can be accomplished within a few minutes. Follow the steps accordingly to obtain the maximum result.

Reply
06/14/2013 14:44

very good !!!! But there's a method to apply this filter to all file in oneshot ;))))

Reply
06/14/2013 14:46

Thanks for such post and please keep it up.

Reply
06/14/2013 14:48

I found this much informative, as to what I was exactly searching for.

Reply



Leave a Reply

    Life Blog

    I am a 36 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.



    Categories

    All
    Flight
    Flphg
    Hang Gliding
    Ios
    Organic
    Parenting
    Programming
    Running
    Sailing
    Video