开发者

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

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

The levels are in this way:

  1. Target Settings
  2. Project Settings
  3. iOS D开发者_如何学运维efault 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).

  1. In Xcode, delete the text from the target-level configuration. Make sure you still have it defined at the project level.
  2. 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.
  3. Quit Xcode.
  4. 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜