简体   繁体   中英

In Objective-C, is there a RELEASE definition besides DEBUG?

Is there a RELEASE defined or maybe it is by another name?

I kind of not want to use

#ifndef DEBUG

#endif

because the n may be less obvious than if we use a RELEASE , which is quite clear.

If none is available, then is adding the following to Support Files/project_name.pch a good way to have RELEASE defined?

#ifndef DEBUG
  #define RELEASE 1
#endif

DEBUG is just defined in Xcode's Build Settings under Preprocessor Macros. In that section you can specify macros to be defined for all builds, debug builds or release builds. Just add RELEASE to the release section and you have what you want; or if you prefer #if over #ifdef put DEBUG=1, RELEASE=0 into the debug section and DEBUG=0, RELEASE=1 into the release section.

(And if you're not using Xcode your build system/compiler should have similar facilities.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM