2

I want to distinguish debug state or release state in iOS App.

How can know programmatically? distinguish code signing identity?

distinguish provisioning profile?

ash84
  • 787
  • 3
  • 12
  • 33
  • 1
    as a rule, you shouldn't have different behaviours on Debug and Release. People who do so often come back later to SO with questions like "My app works fine locally, but crash on the AppStore". Just my.02€ – Stephane Delcroix Oct 17 '13 at 08:33
  • As a rule, you should be testing your release build. – Abizern Oct 17 '13 at 09:48

2 Answers2

6
#ifdef DEBUG
    static BOOL YourAppIsDebug = YES;
#else
    static BOOL YourAppIsDebug = NO;
#endif

With DEBUG being a preprocessor define in the Debug configuration but not in the Release configuration. Or just use #ifdef DEBUG directly, since the static variable isn't going to change and you'd be compiling code that would never run (which might be optimized away by the compiler).

Jesper
  • 7,477
  • 4
  • 40
  • 57
0

You can create custom build schemes that use configurations built off the standard debug and release configurations. You can then set signing identities for those build schemes as you want.

Abizern
  • 146,289
  • 39
  • 203
  • 257