Dinesh Raja
Dinesh Raja

Reputation: 8501

How to add ARC for specific file?

I created a project without ARC. I want to use a third party SDK in my project. That SDK comes with ARC Support. So I want to add ARC for that third party files. I can disable ARC for all "MYProject" files by adding this flag into build phases like -fno-objc-arc.

But I may use large number of files. So it's better to add ARC for specific SDK only. So how to add ARC support for single or specific SDK files in XCode Project?

For Instance: I want to use Grid View. I'm adding GMGridView in my project and it comes with ARC support.

Upvotes: 28

Views: 13914

Answers (2)

Chris Alan
Chris Alan

Reputation: 1426

You add compiler flags in Targets -> Build Phases -> Compile Sources

Compile source show all file that project contain.so please add -fobjc-arc to compiler flag by double clicking on it as show in below image.

enter image description here

Upvotes: 26

Jason Coco
Jason Coco

Reputation: 78393

Add the flag -fobjc-arc to the files that you'd like to use ARC. It's just the opposite of the other.

Upvotes: 63

Related Questions