XCode 编辑项目设置与编辑活动目标
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1240104/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
XCode Edit Project Settings vs Edit Active Target
提问by Edward An
What is the difference between these 2 options under the Project menu drop-down? Normally I just adjusted things in the Project Settings (which adjusts the info.plist, right?).
项目菜单下拉菜单下的这两个选项有什么区别?通常我只是在项目设置中调整内容(调整 info.plist,对吗?)。
Today I needed to change the name of my project. Initially i changed the Product_Name from the Edit Project Settings -> Build window. But that didnt change the name.
今天我需要更改我的项目名称。最初,我从“编辑项目设置”->“构建”窗口更改了 Product_Name。但这并没有改变名字。
Then I tried changing the the Product_Name from the Edit Active Target -> Build window, and that seemed to do the trick.
然后我尝试从 Edit Active Target -> Build 窗口更改 Product_Name,这似乎成功了。
So again, what's the difference? XCode never fails to confuse me just when im beginning to think i have it all figured out! Argh!!!
再说一遍,有什么区别?就在我开始认为我已经想通了的时候,XCode 总是让我感到困惑!啊!!!
回答by Jon-Eric
Project settings apply to all targets in your project. Target settings apply only to that specific target. You likely have only a single target which can make the two sets of settings confusing and appear redundant.
项目设置适用于项目中的所有目标。目标设置仅适用于该特定目标。您可能只有一个目标,这会使两组设置混淆并显得多余。
If a setting is set (appears in bold) for both the project and a target, the target setting overrides the project setting.
如果为项目和目标都设置了设置(以粗体显示),则目标设置将覆盖项目设置。
Target settings which aren't set (do not appear in bold) are inherited from the project settings. Project settings which aren't set (do not appear in bold) are inherited from Xcode's default settings.
未设置的目标设置(不以粗体显示)继承自项目设置。未设置的项目设置(不以粗体显示)继承自 Xcode 的默认设置。
If a setting (either project or target) is set (appears in bold) and you instead want to inherit that setting, select the setting and press Delete.
如果设置了设置(项目或目标)(以粗体显示)而您想要继承该设置,请选择该设置并按 Delete。
I suggest you prefer using the target settings. Use the project settings for larger, multi-target projects where you really do want to share settings across targets.
我建议您更喜欢使用目标设置。将项目设置用于较大的多目标项目,在这些项目中您确实希望跨目标共享设置。
回答by step
It's worth adding that properties set at project level are not automatically inherited from the different configurations / targets of your project: in order to inherit properties that are set at project level you need to set the value $(inherited)
in the fields where you actually want to inherit such properties.
值得补充的是,在项目级别设置的属性不会自动从项目的不同配置/目标继承:为了继承在项目级别设置的属性,您需要$(inherited)
在您实际想要继承的字段中设置值特性。