Is there a way to check if a build is in Adhoc, release, distribution programmatically?

Go To StackoverFlow.com

7

Like the title says, I need a way to detect if the build is in adhoc, release or distribution since I am using keychain-access-groups for each type of build I am using a different provisiong so the bundle seed id are different. I just need an effective way to switch this on certain build.

2012-04-05 15:08
by Frank


13

Go to the target you want to test, then build settings and search for preprocessing and you should see something like this:

enter image description here

As you can see debug already has a value. You can enter RELEASE=1 if you want to check for a release build. Then in your code drop in an if statement like this:

#if DEBUG==1
// do debug build settings stuff there
#endif

#if RELEASE==1
// do release build settings stuff there
#endif
2012-04-05 15:39
by Steve Moser
To check for release build, do #ifndef DEBUG. No need to add RELEASE macro - RajV 2014-02-05 14:52


0

Maybe you can use a Custom Build Setting (aka define), which will have different values in different build configurations?

2012-04-05 15:13
by Denis
Ads