How to setup Xcodes “debug/release target settings”?

为君一笑 提交于 2019-12-10 17:18:51

问题


I have found a set of great macros here Objective C Macros

I put the:

#if DEBUG==1
#define .... macros

in my header file.

Now I simply can't figure out where to set DEBUG=1 or DEBUG=0 in Xcode so that it will define the macro when debugging and not when releasing.

Hope someone can help me find the missing drop down menu:)


回答1:


EDIT:

Ok apparently, when working on an iPhone application, you have to:

  • select iPhone device as the active sdk
  • then edit project or target settings and in "Other C Flags" you type "-DDEBUG=1"

Edit your project or target settings, select your Debug configuration then look for the "Preprocessor Macros" settings and type DEBUG=1

However, I would rather define NDEBUG in the Release configuration then write

#ifndef NDEBUG // if we are in debug mode
#define bla bla bla
#endif

Note: you need to have a target that compiles Objective-C source files to a library or application properly set up; otherwise the settings don't appear in the UI.



来源:https://stackoverflow.com/questions/2017108/how-to-setup-xcodes-debug-release-target-settings

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!