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.

3 Answers 3

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.

Sign up to request clarification or add additional context in comments.

Comments

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

Comments

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.