How to delete user-defined build settings in Xcode

2020-06-30 04:38发布

I have created several user-defined build settings in Xcode 4.3.1. I no longer need these settings and want to delete them, but there doesn't seem to be a way to delete them!

I am aware that these are stored in the project settings (project.pbxproj) file located within the xcodeproj file. But I don't want to edit these in a text editor as there are all sorts of repetitions and guids which I don't understand.

Any suggestions on how I can do this within Xcode? (or have they forgotten to add a "delete" button)

7条回答
爷、活的狠高调
2楼-- · 2020-06-30 04:51

There's a caveat to these answers: If you're using a Build Configuration File (.xcconfig) it doesn't seem possible to delete the user-defined settings generated from these files directly on either the project or target level in the "Build Settings" GUI. You'll have to delete the flag and its value from the configuration file and rebuild the project. If you're using multiple build configuration files that use the same flag, you'll have to delete them from each file.

Although settings that come from these configuration files are displayed in the User Defined build settings section (just like any other user-defined flag that one would create from the GUI), they are not written to the .xcodeproj file like the settings that one adds from the GUI are (which probably prevents them from being able to be deleted from the GUI). They are also not displayed in bold text like these GUI-added settings are.

查看更多
对你真心纯属浪费
3楼-- · 2020-06-30 04:54

Follow the steps below:

  1. Select Project
  2. Tap on the Info tab
  3. Select Configurations
  4. Select Configuration to remove
  5. Press the Delete button on the keyboard
查看更多
smile是对你的礼貌
4楼-- · 2020-06-30 04:55

Removing User-Defined build settings depends on where those settings have been created.

Lets assume that you've created one already and named it as PROJECT_SETTING. In order to check your PROJECT related User-Defined settings, you have to select your project first on the project and targets list, then you should see something like this:

enter image description here

Here you can see only PROJECT related settings, and here you have the only ability edit/delete PROJECT_SETTING.

Besides that if you set up a TARGET, so can add new User-Defined settings there, that only affects that TARGET scope.

enter image description here

You can edit/delete TARGET_SETTING_1 and TARGET_SETTING_2 here, but PROJECT_SETTING is read-only, as it is inherited from your PROJECT settings.

Here you will notice that your TARGET contains your PROJECT User-Defined settings and also your TARGET related User-Defined settings marked as bold letters. This helps you to know which setting can be edited on this level.

You won't be able to delete your settings here if that was created under PROJECT scope, and also editing a PROJECT related User-Defined settings will result a newly created settings that affects only the selected TARGET.

Also if you prefer more visibility on Build Settings, you can select Levels view instead of Combined view, so you should see it more separated:

enter image description here

查看更多
地球回转人心会变
5楼-- · 2020-06-30 04:56

Just figured this out myself: you need to make sure you're at the right scope to be able to delete the setting. If you defined the setting at the project scope, no amount of key-bashing will remove it if you're looking at the target-scope. Remember, targets inherit settings from project scope. That last bit is what I tripped over :)

查看更多
做自己的国王
6楼-- · 2020-06-30 04:59

Try selecting a user-defined setting that you created then hit "Delete" button on your keyboard. That works for me when I encountered the same problem.

查看更多
太酷不给撩
7楼-- · 2020-06-30 05:12

On Xcode 6:
Select the row and hit Fn + Delete.

查看更多
登录 后发表回答