Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I disable ARC for an entire group/folder of files?

I'm aware that you can set the compiler flag -fno-objc-arc to disable Automatic Reference Counting (ARC) for each file in Compile Sources in XCODE but how can I do this for an entire group of files without having to do each file at a time?

The reason I ask is that I've added a large library to my application and I need to set the -fno-objc-arc compiler flag for over 100 files.

like image 429
Camsoft Avatar asked Jan 19 '12 13:01

Camsoft


People also ask

How do I disable ARC in Objective C?

You can disable ARC for a specific class using the -fno-objc-arc compiler flag for that class. In Xcode, in the target Build Phases tab, open the Compile Sources group to reveal the source file list. Double-click the file for which you want to set the flag, enter -fno-objc-arc in the pop-up panel, then click Done.


2 Answers

Goto Build Phases -> Compile sources select multiple files holding command ⌘ and press enter then add the value -fno-objc-arc It will reflect for all the selected files.

like image 69
Krrish Avatar answered Oct 07 '22 12:10

Krrish


I do not think that XCode lets you set this flag for a folder or a group, but you have two reasonable alternatives to setting the flag on individual files:

  1. If your library is self-contained, you can create a separate project for it in the same workspace as your application, and disable ARC for that project.
  2. If you are OK modifying the source of that library, you can attempt an automated ARC conversion.
like image 24
Sergey Kalinichenko Avatar answered Oct 07 '22 11:10

Sergey Kalinichenko