How to re-add deleted build settings - xcode

XCode 7 has allowed me to delete a couple of project settings. How can I add them back?
Here's a picture of before and after...

The projects settings aren't really gone completely, only your overrides of the default values were deleted.
So if you go to the All tab next to the Basic tab in your screenshots, you will see the Base SDK and Build Active Architecture Only entries. But you will have to set them again to the custom values you like.

Related

Adding localizable strings on xcode 10.1

I have a swift app where I now want to add translations for some of the strings used in the app using NSLocalizedString.
In order to do this, I added a file named Localizable.strings to the project and pressed the "localize" button in the file inspector in order to add multiple languages to it. However only english appeared in the localization list, and I seem to be unable to add more.
Having looked around at SO and just googling around, many of the articles on how to do this mention that I should add more languages to my project under build settings. But the only setting I can change under Localization is one named "Localized String Macro Names", and there is no option to add languages there. There is also no "Use Base Internationalization" marker to check.
I have also tried to click on my project, then Editor -> Add Localization, but there all the languages are greyed out and I am unable to chose any of them.
I therefore suppose that you are supposed to do this differently in the latest version of xcode (10.1 atm). Can anyone help me figure out how you are supposed to do it?
It's about the project settings. Take a look at the image:
Under the Localizations you add new languages. After you add the language here you select which files you want to localize.
// update
Click on the top right button shown in the screen below and select your project under the PROJECT tab.
You just selected the wrong settings. The picture that you attached is actually under TARGET settings -> Build Settings, rather than project settings.
See the picture below to select "project settings" under xcode 10:
Xcode 10, project settings

Debug rows missing from Code Signing and Provisioning Profile sections

The problem:
With All/Combined selected from the top menu within either the Project or the Target, this is what I see. Debug used to be listed within the Provisioning Profile and Code Signing Identity sections, but it is now missing. I can build a run on the simulator like this but when trying to deploy to a tethered testing device I get errors about provisioning profile and code signing being required.
This is not a duplicate of 'Provisioning profile' options missing from 'Code signing' Xcode 6.3 because I have All/Combined selected. It's not just that Debug is not visible in the list... it doesn't even exist anymore in the project.pbxproj file that Xcode uses to build the list.
What caused it:
I was trying to remove a profile in Xcode 7.3.1 and pressed the delete key without realizing the root debug row was selected rather than the child row which holds the profile itself. I can add a child (e.g. a release type such as Any iOS SDK) to a Release or Debug row by hovering over the parent row and clicking the +, but I can't add a new root item like Debug that way. No + is available when hovering over the Code Signing or Provisioning Profile rows. Unfortunately, while I can't remove one of these root rows with the mouse (no - button on them), I can accidentally do so with the delete key – which is what led to this broken state.
What I've tried:
Cleaning, restarting Xcode and computer, reinstalling Xcode, upgrading to Xcode 8, migrating to Swift 2.3, migrating to Swift 3, etc. I used a text editor with JSON syntax highlighting to opened multiple versions of the project.pbxproj file (some before the deletion) to see the differences. The project.pbxproj file is used to generate the menu items for the project and target. The old version is missing many new settings for the Release section found in the new version now that it has gone through several upgrade iterations with Xcode and Swift migrations. Among other concerns with that file, I wouldn't even know what was missing from the Debug section I'd be trying to add back. I could start a fresh project and copy over the Debug section from it's project.pbxproj file, but I'm convinced that manually editing that file to try to add the debug items back is a bad idea. There's probably a better option.
Question:
What's the best way to restore the missing Debug menu items?
What I would suggest is to create "manually" the new Debug configuration. You will not restore your old configuration but you will be able to set the correct configuration for the Debug configuration.
The operation is described in Adding a build configuration in Xcode but in your case you will have to duplicate the Release configuration and edit it to fit your requirements.
I also guess you will have to edit your schemes to use the correct configuration for each action (build/run/...).

Clean Build Folder option disabled in Xcode 5

I have an iOS project that builds and runs fine, but the "Clean Build Folder..." option is disabled. As a matter of fact, it is disabled in all of my projects (all iOS, some in workspaces).
They have not been upgraded from previous Xcode version as discussed in this thread.
To See the Clean Build Folder... option, hold the option key while viewing the Product menu.
What can I do to enable it?
Update:
Almost a year later. Currently on Xcode 6.3. Still no luck.
I tried the following steps.
Preference --> Locations -->
For derived data, click "Advanced".
Inside build location, choose "Unique".
The "Clear Build Folder" button appears again.
I had this problem with a project in Xcode 8, and found that in addition to the setting #ycwjjjj mentioned, I also needed to check File → Workspace Settings… → Advanced… and switch away from Custom Settings to Unique (or Xcode Default).

How to delete user-defined build settings in Xcode 4.3.1

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)
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 :)
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.
On Xcode 6:
Select the row and hit Fn + Delete.
Follow the steps below:
Select Project
Tap on the Info tab
Select Configurations
Select Configuration to remove
Press the Delete button on the keyboard
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:
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.
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:
Select one of them and press keyboard's delete button.
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.

How delete the config in Build Settings in a low level in XCode 4

In XCode 4.0.2 there is a good way to configure the program in Build Settings when you click in "Levels" format. Like this screen
The levels are in this way:
Target Settings
Project Settings
iOS Default Settings
So the XCode see if the Target have a config, if not see in project and if not use the iOS default.
The problem here is that when you set a config in a low level and than delete it, it's impossible use the config of a upper level.
Like in image. I set all targets to use Google in Current Project Version, but in this target I want it use stackOverflow and it work. But in the other Generated Versioning ... I first config with stackOverflow but change my mind and want to use the Project Settings. Now is impossible delete the Target Settings and I will have to enter it manually.
How can I delete the target setting to use the project setting?
In xcode 5 it worked right simple for me. I had the same situation as in the picture in the question. Some data in the project setting and an empty but green setting on target level.
You have to select the line e.g. with the mouse that is marked and afterwards press the delete button the green marking is gone from the target level. In my test it and it will never delete the setting on the highes level, so there is no risk.
Click the Combined button and change the build setting value. Now when you click the Levels button, you will see the target and project both have the new value for the build setting.
I just figured this out. It's a little sketchy, but it works, and does not feel dangerous to me (particularly if you're using version control).
In Xcode, delete the text from the target-level configuration. Make sure you still have it defined at the project level.
Look at a diff of the YourProjectName.xcodeproj/project.pbxproj so you can figure out the code-level name of the setting you just changed. For example, in Xcode, I deleted the text from my target-level configuration for "Other C Flags". My diff showed the OTHER_CFLAGS setting changing from OTHER_CFLAGS="mytargetlevelsetting" to OTHER_CFLAGS="". If you're using version control (which you should be), it'll be easy to get this diff.
Quit Xcode.
Open up YourProjectName.xcodeproj/project.pbxproj in a text editor. Find all the lines starting with the setting name you found in step 2. Delete all the ones where the value is an empty string, and keep all the rest. For example, I deleted all the lines that said OTHER_CFLAGS="", but kept all the lines that said OTHER_CFLAGS="settingiwanttokeep". If you don't see any where the value is an empty string, or all their values are empty strings, you probably didn't follow step 1.
When you reopen Xcode and look at your target's build settings again, the setting in question should be using the project-level configuration, not the target.

Resources