0

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.

Mike S
  • 4,092
  • 5
  • 35
  • 68

3 Answers3

2

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.

Community
  • 1
  • 1
Chris Chen
  • 5,307
  • 4
  • 45
  • 49
1

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];
#endif
omz
  • 53,243
  • 5
  • 129
  • 141
Mike Crawford
  • 2,232
  • 2
  • 18
  • 28
0

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

#endif

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

Ignacio Inglese
  • 2,605
  • 16
  • 18