Enable or Disable ARC on single file in a Project

ARC (Automatic Reference Counting) was introduced in iOS 5.0 SDK.
Although there is no difference in the execution of an ARC program and a well written MRC (Manual Reference Counting), it is good to use ARC if it is annoying for you to manually keep track of reference counting of objects that you create. On other hand using ARC also decreases your line of code count.

But leaving all the advantages or disadvantages aside, during your iOS development experience you may fell into a situation when you want to enable or disable ARC base compilation for one or more files in a project but not the complete project.

You don’t have to do any hack for this just simply
1 – Go to TARGETS.
2 – Select Build Phases.
3 – Click the small arrow left to the text Compile Sources. It will open up list of all the .m files of your project.
4 – Double click the file name for which you want to enable ARC and just write this flag -fobjc-arc and you are done.
Likewise if you want to disable ARC for any file just write the flag -fno-objc-arc then this file will be compiled as a MRC file.

About Sallah Ud Din Sarwar

I am a multi skilled Software Engineer with over 4 year’s industry experience in designing and developing Object oriented solutions in Multi layered & N-Tired. I have substantial success to my credit. I have consistently handled complex problems to the satisfaction of my clients by working in stressful situations. I enjoy learning and applying new technologies in a dynamic and forward thinking professional environment.

Check Also

The Top SEO Techniques You Need to Drive More Traffic

If you’re on this page you’re probably already convinced of the importance of attracting organic …

Leave a Reply