I have sections in my code (for example in the AppDelegate.m) that should not be compiled for the Unit Tests, like
#ifndef CONFIGURATION_TESTS
// Code that should not be compiled in the Unit Tests
#endif
Targets are set up by Xcode when you select 'add Unit Tests' when creating a new project. In the Project File, I have added the Flag CONFIGURATION_TESTS to the Preprocessor Macros for the MyAppTests Built-Target but not for the MyApp Target.
This was the suggested way in many posts that i've found.
But this doesn't work, because (i guess) the MyAppTests target has the MyApp target as a dependency and because AppDelegate.m is added to the MyApp target, it gets compiled with the MyApp build settings and hence, the CONFIGURATION_TESTS is not defined.
In the unit-test files the macro is defined and behaves as expected (because the test files are only build by the MyAppTests target ?)
Does anyone know how do this, i thought this would be a common problem...