Xcode: TEST vs DEBUG preprocessor macros

后端 未结 11 897
余生分开走
余生分开走 2020-11-28 06:24

When creating a new project with unit tests, Xcode sets the build configuration to Debug for the Test scheme (same for the Run scheme).

Should I differentiate betwee

11条回答
  •  抹茶落季
    2020-11-28 06:34

    You might consider adding a new build configuration.

    In xcode 4, click on your project on the left hand navigator.

    In the main window, click on your project, and then select the "info" tab.

    Click the "+" button to add a new configuration (you can call yours "test" if you like").

    Now, click on your target, and go to the build settings tab.

    Search for "preprocessor macros"

    Here, you can add preprocessor macros for your new build configuration.

    Just double click on your new "test" configuration, and add TESTING=1.

    Finally, edit your build scheme. Select the test options for your scheme. There should be a "Build Configuration" drop down menu. Select your "test" configuration.

提交回复
热议问题