I have issue with disabling some code lines for testing purpose.
I have 2 targets - 1st my Product, 2nd my KIF test target. In KIF test target, macro is defined as KIF=1 In Product target, macro is defined as KIF=0
Then code was included in following:
#ifndef KIF
.... some code.....
#endif
Unfortunately, this code doesn't work for any target.
Maybe it happens because Product target is set in target dependency for KIF target?
Could you please help me to solve my issue?
It was more easy than i can imagine. Go to your Project > Configurations and create new configuration via tapping on plus '+' button > Duplicate Debug Configuration, then you can create new variable like TESTING and define it only for your configuration. The next step is include in #if your code and change configuration in your scheme.
#if TESTING
{
...some code for testing needs...
}
#else
{
...your regular code...
}
#endif
In Product > Scheme > Edit Scheme > Test, change Build Configuration to your own one and test it.