I just reopened a project that was set to use Garbage Collection, and that I had last opened in Xcode 3. Now opening it again in Xcode 4.5, and looking to modernize it, I am trying to switch on ARC. However, when building, it resulted in clang error 1. Looking into more details in the Xcode logs, I saw the message:
clang: error: cannot specify both ‘-fobjc-arc’ and ‘-fobjc-gc-only’
Ah, I need to switch off Garbage Collection, which I was using before. However, when searching the build setting for the word ‘garbage’ or ‘collection’, I can’t find the setting in Xcode (using the search field in the Build Settings in the target info).
Probably because garbage collection is now deprecated, the setting has been turned into a user-defined setting, and is using the gcc name ‘GCC_ENABLE_OBJC_GC’. This is why it won’t show up when doing a search for ‘garbage’ or ‘collection’. Instead, you have to look for that setting at the bottom of the Build Settings, or search for the string GCC_ENABLE_OBJC_GC using the search field.
This needs to be done at the project level or at the target level.