I cannot get this macro to compile the correct code.
Here is the code: 
Here are the build settings (I'm doing Release builds):
Note that the GCC documentation states -Dname will be defined as 1, so I omitted "= 1" for Release: 
Here is the compilation log showing that the definition (in yellow) was passed on the command line: 
Here is my output log showing that the code was compiled as if ADD_CAMERA_FEATURE had not been defined: 
If I put #define ADD_CAMERA_FEATURE 1 in the source, #ifdef works as expected, but I also get a warning that I am redefining an existing macro. Thus, Xcode knows that the macro must exist from the assembly schema settings, but still does not include the #ifdef code branch.
Other information:
- Xcode 5.1
- OS X 10.9.2
- iOS 7.1
My goal is to have a goal for creating a version of an iOS 7 application and a goal for creating a version of an application prior to iOS 7, from one source. I have to support older devices that cannot be updated to iOS 7 even longer. There may be a better way to do this. Any suggestions on how to do this would be appreciated.
macros ios objective-c xcode
Chuck krutsinger
source share