Take the 2-minute tour ×

I have various buttons on a few screens of my iPad app that I enable during development. One such example is a delete cache button. The problem is that controls such as this have to be manually hidden before I post to the app store or build an adhoc build for a customer. Can I some how detect through the code that I'm debugging or using a version of the app that was put there via debugging and programatically have a "isDeveloperMode" flag that is somehow linked to which target I ran?

Sorry if this question is a bit confusing, but I have been wondering about this for a while now.

share|improve this question

3 Answers 3

up vote 2 down vote accepted

This post Enable and Disable NSLog in DEBUG mode addresses how to enable NSLog only in DEBUG mode. I think you may consider using the same approach to hide some of the buttons when it's in RELEASE mode.

share|improve this answer

Xcode's build settings has an item for "Other C Flags". In your Release build, add a setting like "-DRELEASE=1". That defines a C preproccesor macro and sets it to one.

Then in your code:

#ifndef RELEASE
[self showDeveloperButtons];
share|improve this answer

You should be able to achieve this by using Xcode's default flag for debug.

Just check for DEBUG to be defined and you should be good to go.

In case you're using Interface Builder created UI you can just hide everything. Or if you create them programmatically you could just set the calls within.

#ifdef DEBUG

// Code to add those buttons or hide the ones already existing


All the code defined above won't be at all in the final build when using release configuration.

share|improve this answer

Your Answer


