Mastering macOS Programming
上QQ阅读APP看书,第一时间看更新

Creating a new build configuration

The default Xcode project template already creates two build configurations for you, Debug and Release, but we're going to leave those alone and create a new one:

  1. Select the project file in the project navigator to go to the project settings screen, and select the Info tab:
  1. Click the + button underneath the configurations list in the Configurations section.
  2. From the contextual menu that appears, select Duplicate Debug Configuration and name it Dev.
  1. From the schemes menu, select our SalesTaxCalc Dev scheme if you haven't already, and then select Edit Scheme... from the same menu.
  2. In the scheme editor window, select Run from the list on the left-hand side of the window (it should be preselected), and choose the Dev configuration from the Build Configuration menu, as follows:
  1. Do the same for Archive. No need to change the others (Test, Profile, and so on) at the moment, so click Close.

Now, when we hit Run, the app will build according to the specifications of the Dev build configuration. But of course, we haven't done anything yet to make our configuration any different from the default Debug configuration, so running the app again now isn't going to be the most thrilling of experiences. However, when we go to the Build Settings tab, we will discover that many of the settings there allow us to specify different values according to which build configuration is used in the active build scheme. That's where the fun starts, and that's our next task.