- Home /
iOS - Disable ARC on XCode Projects
Is there a way to disable Automatic Reference Counting (arc) when Unity builds the XCode project? When I open the XCode project, I see that Objective-C Automatic Reference Counting is set to "Yes" in Build Settings. But having this on is breaking a plugin that I have. I want to know how to change this when it builds the project so I don't have to remember to switch it every time I make a new build.
I'm using Unity 5 Beta v18 on a Mac. Trying to build with default iOS Settings.
Thanks in advance for any help.
Answer by s2quinnh · Jan 28, 2015 at 11:31 PM
I figured it out! For others out there that might run into this issue, here's how to fix it.
I didn't realize Unity allowed you to add custom Compile flags to individual plugins. Simply find your plugin code in the Assets/Plugins/iOS/ folder, select the file that's giving you problems. In the Inspector you should see "Compile flags" towards the bottom. Add -fno-objc-arc to this and hit "Apply." Now Unity will compile the XCode project with ARC turned off for this file. Pretty neat!
I tried to do this and still get the compiler errors on using the release method. Any idea what I might have missed? I did hit apply.
turns out I had to Replace the project when I built it. Just doing the Append option didn't seem to update the compiler flags for the file.
Glad you got it to work! And thanks for posting an answer for the future people who have the same problem.
Hmm. I do not see compile flags in the inspector in 4.6.x. Is it just 5? The patch notes do mention that compile flags were added to 4.6... Just not sure where. Anyone?
Hey thanks! You saved me a bunch of hours googling... God bless u
Answer by ickydime · Nov 13, 2015 at 07:26 AM
If you have 4.6.x you can do it via a Post Process build script. See this as an example: