How can I access a user-defined Xcode build setting?

前端 未结 6 880
忘了有多久
忘了有多久 2020-12-13 00:24

If I added a user-defined setting in my build configuration, how can I read that setting in my Objective-C code?

I have two files in my project, debug.plist

6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-13 00:40

    Your code can't read arbitrary build settings. You need to use preprocessor macros.

    EDIT: For example, in the target settings for the Debug configuration, you could add DEBUGGING=1 in the Preprocessor Macros build setting, and not define DEBUGGING in the Release configuration. Then in your source code you could do things like:

    #if DEBUGGING
      use this file
    #else
      use the other one
    #endif
    

提交回复
热议问题