Pregunta

I am working with an iOS project that uses

#if defined (FREE_VERSION) 

The project has two targets, each of a free and paid version. If I run the free, the code under the above statement fires, and if I run the paid, the "else" code fires. That's all as expected.

But when I search the project for "FREE_VERSION" or "#defined", I get no results (other than the "#if defined" statements). So where might FREE_VERSION be defined?

I'm not very familiar with pre-processor directives and #define, so I may not be using the right terminology here. But, any help would be appreciated!

¿Fue útil?

Solución

With defines like this, I assume you will find it in project settings -> build settings -> preprocessing.

The idea behind it is that you have several schemes/build targets which behave differently and you don't have to change code to setup your build, you just switch between schemes/targets.

DEBUG is an example of a similar macro, which is defined by default for Debug configuration.

Otros consejos

That's up to you to #define it somewhere. You could have a constants header file and define it there.

In free version:

Global.h:

    #define FREE_VERSION

Then you can comment it out later when compiling paid version.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top