How to enable ARC programmatically for specific files in a project without ARC xcode?

I have a situation where I need to enable ARC for many files in multiple projects without xcode ARC. I do not want a complete conversion to ARC, only a few files should be included with the arc.

There are many solutions that include the -fobjc-arc flag for specific files in compilation sources using the Xcode console. But I have too many files in several xcode projects to individually modify it with Xcode.

Is there a way by which I can programmatically change the parameters of the build phase. I found several posts, for example

Both of them are good solutions, but I need to set up a mechanism where I can write scripts to manage them. Since some of them run on servers, and the resulting xcode is distributed to other users for testing.

Manipulating the project.pbxproj code seems to be the most likely choice. But I'm not sure how to do this.

+4
source share
3 answers

.pbxproj .xcodeproj, , . , , , . .pbxproj :

D5298D04170F232900D3B684 /* ASIHTTPRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = FACE22CF15B72C4C00A0A4AD /* ASIHTTPRequest.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };

:

D5298D02170F232900D3B684 /* GradientShapeView.m in Sources */ = {isa = PBXBuildFile; fileRef = FACE22C715B6F90000A0A4AD /* GradientShapeView.m */; };

, , .pbxproj 4 . 12 , 48 .

, . , , perl- .

+2

-ARC, :

  • -fobjc-arc ARC
  • ARC ( ARC )
+2

, ARC, , return/enter. , -fobjc-arc, .

+1
source

All Articles