How to know in debug mode in xcode?

Discussion in 'iOS Programming' started by mikezang, Aug 30, 2010.

  1. mikezang macrumors 6502a

    Joined:
    May 22, 2010
    Location:
    Tokyo, Japan
    #1
    My app has some code to initialize data, and I want to those code only useful in debug mode, I mean they won't compile in release mode.

    Is there any keyword (like __DEBUG__) so that I can use it to condition compile my app.

    I searched Internet but no result.
     
  2. ianray macrumors 6502

    Joined:
    Jun 22, 2010
    Location:
    @
    #2
    Google:
    Code:
    xcode debug flag
    Or, under 'Target' Info, 'Build' tab, "Preprocessor Macros" add:
    Code:
    DEBUG=1
     
  3. mikezang thread starter macrumors 6502a

    Joined:
    May 22, 2010
    Location:
    Tokyo, Japan
    #3
    Xcode know where I am at, debug mode or release mode, so I think there should be a global flag we can use and needn't write code like DEBUG = 1, this flag should maintenance by xcode, not developer. so I just write code as below, I don't need take care if I am at debug mode, is it possbile?

    Code:
    #if _DEBUG_ 
     // do something
    #endif
    
    
     
  4. ianray macrumors 6502

    Joined:
    Jun 22, 2010
    Location:
    @
    #4
    If you think XCode should support this, then please go ahead and request it from Apple :)

    If you want to know how to do this, read my last post :D
     
  5. mikezang thread starter macrumors 6502a

    Joined:
    May 22, 2010
    Location:
    Tokyo, Japan
    #5
    I got that info from Internet before I post thread, maybe my question is not so clear.

    Anyway, thanks for your message.
     

Share This Page