Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detect if App is production version or Development version

I need to detect at run time whether my apps copy is Production/Development version. Is there any methods to achieve the same.

I am looking forward to develop push notification API which will send APNS messages to server accordingly(i.e. sandbox or without sandbox).

Any help? thanx in advance.

like image 997
vje1998 Avatar asked Apr 07 '16 10:04

vje1998


1 Answers

In that case you can use conditional compiling and check if you are in debug mode.

In your project settings you should have defined a preprocessor macro to indicate the debug build:

preprocessor settings

you can use that or define your own.

in your code you can put:

    NSString* platform = @"ios";
#if DEBUG
    platform = @"ios_sandbox";
#endif

everything between #if DEBUG and #endif will only be compiled when DEBUG=1 is defined (in this case only in debug configuration) so at the end you will have in platform variable the value of ios in release builds and ios_sandbox in debug builds.

like image 122
Jorge Arimany Avatar answered Oct 25 '22 00:10

Jorge Arimany